Documentation ¶
Index ¶
Constants ¶
const ( // Expose secretbox's Overhead const here for convenience. Overhead = secretbox.Overhead KeySize = 32 NonceSize = 24 DefaultN = 16384 // 2^14 DefaultR = 8 DefaultP = 1 )
Various constants needed for encryption scheme.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type CryptoKey ¶
CryptoKey represents a secret key which can be used to encrypt and decrypt data.
func GenerateCryptoKey ¶
GenerateCryptoKey generates a new crypotgraphically random key.
func (*CryptoKey) Decrypt ¶
Decrypt decrypts the passed data. The must be the output of the Encrypt function.
func (*CryptoKey) Zero ¶
func (ck *CryptoKey) Zero()
Zero clears the key by manually zeroing all memory. This is for security conscience application which wish to zero the memory after they've used it rather than waiting until it's reclaimed by the garbage collector. The key is no longer usable after this call.
type Parameters ¶
Parameters are not secret and can be stored in plain text.
type SecretKey ¶
type SecretKey struct { Key *CryptoKey Parameters Parameters }
SecretKey houses a crypto key and the parameters needed to derive it from a passphrase. It should only be used in memory.
func NewSecretKey ¶
NewSecretKey returns a SecretKey structure based on the passed parameters.
func (*SecretKey) DeriveKey ¶
DeriveKey derives the underlying secret key and ensures it matches the expected digest. This should only be called after previously calling the Zero function or on an initial Unmarshal.
func (*SecretKey) Marshal ¶
Marshal returns the Parameters field marshalled into a format suitable for storage. This result of this can be stored in clear text.