dpass

package module
v0.0.0-...-334998e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 20, 2016 License: BSD-2-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultMax       = -1
	DefaultLength    = 24
	DefaultSymbolSet = "~!@#$%^*_+-=;,./?"
)
View Source
const (
	Number = iota
	Upper
	Lower
	Symbol
)
View Source
const AppName = "dpass"
View Source
const LatestGenVersion = uint64(1)

This is the version of the generator. It is encoded into the output blob for reverse compatibility if the generation algorithm has changed

Variables

This section is empty.

Functions

func BlobIndexPrefix

func BlobIndexPrefix(dom string, pw []byte) (string, error)

Given a domain and password, return the blob index prefix which can be used by an interface to look up all blobs for that domain

func GenPW

func GenPW(g *GenOpts, pw []byte) (string, error)

GenPW will perform all the steps required and return a deterministic password based on the supplied options and master password

Types

type GenOpts

type GenOpts struct {
	Domain     string `json:"d"`
	Username   string `json:"u"`
	Iteration  uint64 `json:"i"`
	Length     uint64 `json:"c"`
	GenVersion uint64 `json:"pwv"`
	Numbers    uint64 `json:"n"`
	MaxNumbers int    `json:"mn"`
	Uppers     uint64 `json:"U"`
	MaxUppers  int    `json:"mU"`
	Lowers     uint64 `json:"l"`
	MaxLowers  int    `json:"ml"`
	Symbols    uint64 `json:"s"`
	MaxSymbols int    `json:"ms"`
	SymbolSet  string `json:"ss"`
	// contains filtered or unexported fields
}

func FromJSON

func FromJSON(d []byte) (*GenOpts, error)

func NewGenOpts

func NewGenOpts(u, d string) *GenOpts

NewGenOpts returns default options

func (*GenOpts) Blob

func (g *GenOpts) Blob() (string, error)

Blob returns a base32 encoded encrypted blob of the json encoded options. First the json is compressed, then encrypted using the sha512_256 sum of the scrypt master password hash + the domain name. This makes the encryption key unique for each domain, but allows decrypting all entries for a single domain with a single key so that an interface can allow choosing from entries in a domain.

func (*GenOpts) BlobIndex

func (g *GenOpts) BlobIndex() (string, error)

BlobIndex returns the index string which can identify an encrypted options blob. The first 22 characters are the base32 double sha512_128 sum of the domain name and mphash. The remaining 6 characters are a hash of the json encoded options to uniquely identify this entry for the domain. This makes searching for entries for a given domain possible before decryption.

func (*GenOpts) GenPW

func (g *GenOpts) GenPW() (string, error)

GenPW will generate a deterministic password based on the initialized options and hashed master password.

func (*GenOpts) HashPw

func (g *GenOpts) HashPw(pw []byte) error

HashPw will generate the scrypt hash of the password which will be used to seed the prng used by the password generator. HashPw will call Init() if it has not already been called. HashPw will zero pw before returning.

func (*GenOpts) JSON

func (g *GenOpts) JSON() ([]byte, error)

JSON is an unncrypted JSON representation of the generation options

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL