Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrInvalidLen = errors.New("invalid ciphertext length")
)
Functions ¶
func New32Key ¶
func New32Key() [32]byte
NewKey generates a new random key value, of 256 bytes in size
Types ¶
type Cryptographer ¶
type Cryptographer interface {
// NewSalt generates a new random salt value, of 128 bytes in size
NewSalt() [128]byte
// New256Key generates a new random key value, of 256 bytes in size
New256Key() [256]byte
// New32Key generates a new random key value, of 256 bytes in size
New32Key() [32]byte
// NewCipher generates a new AES cipher based on the input key
NewCipher(key []byte) EncryptDecrypter
// Random reads random bytes into the input byte slice
Random(buffer []byte)
}
Cryptographer describes the set of cryptographic actions required by the app
type EncryptDecrypter ¶
type EncryptDecrypter interface {
// Encrypt will encrypt the input bytes `v` with the EncryptDecrypter key,
// returning the ciphertext of `v` as a byte slice, and an error
Encrypt(v []byte) ([]byte, error)
// Decrypt will decipher the input bytes `v` with the EncryptDecrypter key,
// returning the plaintext of `v` as a byte slice, and an error
Decrypt(v []byte) ([]byte, error)
}
EncrypterDecrypter is a general purpose encryption interface that supports an Encrypt and a Decrypt method
func NewCipher ¶
func NewCipher(key []byte) EncryptDecrypter
NewCipher generates a new AES cipher based on the input key
Click to show internal directories.
Click to hide internal directories.