Documentation ¶
Overview ¶
Package keymgt implements trivial binary encoding for nacl public/private keys
Index ¶
- Constants
- Variables
- func GenerateKey(password, extradata []byte) (keyfile, mpubkey, mprivkey []byte, err error)
- func LoadKey(keyfile, password []byte) (pubkey, privkey, extradata []byte, err error)
- func SaveKey(pubkey, privkey, password, extradata []byte) (keyfile, mpubkey, mprivkey []byte, err error)
Constants ¶
View Source
const ( // SaltField is the salt used for encryption SaltField = iota + 1 // PasswordFlagField shows if a password is set PasswordFlagField // MyPublicKey is my public key MyPublicKey // CryptPublicKey is the public key for encryption CryptPublicKey // Nonce is the nonce for NaCL encryption Nonce // NaCLBox is the encrypted data NaCLBox // PrivateKey is the private key PrivateKey // ExtraData is additional data added to the secret part ExtraData )
Variables ¶
View Source
var ( // ErrMissingField is returned when fields are missing ErrMissingField = errors.New("keymgt: missing fields") // ErrMissingPassword is returned if no needed password was given ErrMissingPassword = errors.New("keymgt: no password when one was needed") // ErrWrongPassword is returned if the private key cannot be decrypted ErrWrongPassword = errors.New("keymgt: wrong password") )
Functions ¶
func GenerateKey ¶
GenerateKey returns a keyfile, optionally encrypted by password. Extradata can be appended
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.