Documentation ¶
Overview ¶
Package pc provides crypto functions for use by passgo. The purpose of pc is to provide safe interfaces that factor confusing and common programming errors away from programmers.
Index ¶
- Variables
- func GeneratePassword(specs *PasswordSpecs, passlen int) (pass string, err error)
- func GetMasterKey() (masterPrivKey [32]byte)
- func GetSitesIntegrity() pio.ConfigFile
- func Open(key *[32]byte, ciphertext []byte) (message []byte, err error)
- func OpenAsym(ciphertext []byte, pub, priv *[32]byte) (out []byte, err error)
- func Scrypt(pass, salt []byte) (key [32]byte, err error)
- func Seal(key *[32]byte, message []byte) ([]byte, error)
- func SealAsym(message []byte, pub *[32]byte, priv *[32]byte) (out []byte, err error)
- type PasswordSpecs
Constants ¶
This section is empty.
Variables ¶
var ( // DigitLowerBound is the ascii digit lower bound. DigitLowerBound = 48 // DigitUpperBound is the ascii digit upper bound. DigitUpperBound = 57 // UpperCaseLowerBound is the ascii upper case lower bound. UpperCaseLowerBound = 65 // UpperCaseUpperBound is the ascii upper case upper bound. UpperCaseUpperBound = 90 // LowerCaseLowerBound is the ascii lower case lower bound. LowerCaseLowerBound = 97 // LowerCaseUpperBound is the ascii lower case upper bound. LowerCaseUpperBound = 122 // SymbolGrp1LowerBound is the ascii lowerbound of the first symbol grp. SymbolGrp1LowerBound = 33 // SymbolGrp1UpperBound is the ascii lowerbound of the first symbol grp. SymbolGrp1UpperBound = 47 // SymbolGrp2LowerBound is the ascii lowerbound of the first symbol grp. SymbolGrp2LowerBound = 58 // SymbolGrp2UpperBound is the ascii lowerbound of the first symbol grp. SymbolGrp2UpperBound = 64 // SymbolGrp3LowerBound is the ascii lowerbound of the first symbol grp. SymbolGrp3LowerBound = 91 // SymbolGrp3UpperBound is the ascii lowerbound of the first symbol grp. SymbolGrp3UpperBound = 96 // SymbolGrp4LowerBound is the ascii lowerbound of the first symbol grp. SymbolGrp4LowerBound = 123 // SymbolGrp4UpperBound is the ascii lowerbound of the first symbol grp. SymbolGrp4UpperBound = 126 )
Functions ¶
func GeneratePassword ¶
func GeneratePassword(specs *PasswordSpecs, passlen int) (pass string, err error)
GeneratePassword is used to generate a password like string securely. GeneratePassword has no upper limit to the length of a password that it can generate, but is restricted by the size of int. It requires generation of a string password that has a upper case letter, a lower case letter, a symbol, and a number.
It works by reading a big block of randomness from the crypto rand package and searching for printable characters. It will continue to read chunks of randomness until it has found a password that meets the specifications of the PasswordSpec passed in to the func.
func GetMasterKey ¶
func GetMasterKey() (masterPrivKey [32]byte)
GetMasterKey is used to prompt user's for their password, read the user's passgo config file and decrypt the master private key.
func GetSitesIntegrity ¶
func GetSitesIntegrity() pio.ConfigFile
GetSitesIntegrity is used to update the sites vault integrity file.
func Scrypt ¶
Scrypt is a wrapper around scrypt.Key that performs the Scrypt algorithm on the input with opinionated defaults.
Types ¶
type PasswordSpecs ¶
PasswordSpecs indicates specifications for a desired generated password.
func (*PasswordSpecs) Satisfied ¶
func (s *PasswordSpecs) Satisfied() bool
Satisfied will determine if a PasswordSpecs type indicates it no longer needs any more specs.