Documentation ¶
Index ¶
Constants ¶
const BufferSize int = 8 * 1024
BufferSize defines the size of the stream buffer in bytes.
const IvSize int = 12
IvSize defines the length of the iv in bytes.
const KeyPasses int = 872791
KeyPasses defines the number of rounds for PBKDF2.
const KeySize int = 32
KeySize defines the length of the key in bytes.
const SaltSize int = 32
SaltSize defines the length of the salt in bytes.
Variables ¶
This section is empty.
Functions ¶
func ClearMem ¶
ClearMem overwrites the memory of the byte array passed as data with random data.
It returns true if the overwrite was successfull, false if not.
func DecryptFile ¶
func DecryptFile(args *DecryptArgs) error
DecryptFile decrypts a file using the cipher and writes it to the output defined in args.
func EncryptFile ¶
func EncryptFile(args *EncryptArgs) error
EncryptFile encrypts a file using the cipher and writes it to the output defined in args.
func GenKey ¶
GenKey generates a secure key based on a password and salt using the PBKDF2 function with SHA512. The key length is fixed and defined by KeySize.
It returns a pointer to a byte array containing the key.
func RandomIv ¶
RandomIv generates a secure, random iv with a fixed length defined by IvSize.
It returns true or false on success or failure and the iv as byte array.
func RandomSalt ¶
RandomSalt generates a secure, random salt with a fixed length defined by SaltSize.
It returns true or false on success or failure and the salt as byte array.