Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Default options to use when generating a key. DefaultEncryption = OptionsConfig{ Algorithm: AES256CBC, Iterations: 1, MinPasswordLength: 32, SaltBits: 256, } // Default options to use when generating a key for integrity. DefaultIntegrity = OptionsConfig{ Algorithm: SHA256, Iterations: 1, MinPasswordLength: 32, SaltBits: 256, } )
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // Password to use. If not specified, the password buffer will be used. Password string // Password buffer to use. If not specified, the password will be used. PasswordBuffer []byte // Encryption options. Options OptionsConfig }
Key generation options.
type GeneratedKey ¶
type GeneratedKey struct { // AES128CTR | AES256CBC | SHA256 Algorithm Algorithm // Encryption key. Key []byte // Salt used. Salt string // IV used. IV []byte }
Key generation result.
func Generate ¶
func Generate(cfg Config) (GeneratedKey, error)
Generate a key to use for encryption.
type OptionsConfig ¶
type OptionsConfig struct { // AES128CTR | AES256CBC | SHA256 Algorithm Algorithm // Total number of iterations to use. More iterations are more secure but slower. Iterations int // Minimum password length. Shorter passwords are less secure. MinPasswordLength int // Number of bits to use in the salt. More bits are more secure but slower. SaltBits int // Salt to use. If not specified, a random salt will be generated. Salt string // IV to use. If not specified, a random IV will be generated. IV []byte }
Encryption options.
Click to show internal directories.
Click to hide internal directories.