Documentation ¶
Overview ¶
Package aez implements the AEZ AEAD primitive.
Index ¶
Constants ¶
const (
// Version is the version of the AEZ specification implemented.
Version = "v5"
)
Variables ¶
This section is empty.
Functions ¶
func Decrypt ¶
func Decrypt(key []byte, nonce []byte, additionalData [][]byte, tau int, ciphertext, dst []byte) ([]byte, bool)
Decrypt decrypts and authenticates the ciphertext, authenticates the additional data, and if successful appends the resulting plaintext to the provided slice and returns the updated slice and true. The length of the expected authentication tag in bytes is specified by tau. The ciphertext and dst slices MUST NOT overlap.
func Encrypt ¶
func Encrypt(key []byte, nonce []byte, additionalData [][]byte, tau int, plaintext, dst []byte) []byte
Encrypt encrypts and authenticates the plaintext, authenticates the additional data, and appends the result to ciphertext, returning the updated slice. The length of the authentication tag in bytes is specified by tau. The plaintext and dst slices MUST NOT overlap.
func IsHardwareAccelerated ¶
func IsHardwareAccelerated() bool
IsHardwareAccelerated returns true iff the AEZ implementation will use hardware acceleration (eg: AES-NI).
Types ¶
type AeadAEZ ¶
type AeadAEZ struct {
// contains filtered or unexported fields
}
AeadAEZ is AEZ wrapped in the crypto/cipher.AEAD interface. It expects a 16 byte nonce, and uses a 16 byte tag, per the recommended defaults in the specification.
The AEZ primitive itself supports a vector of authenticated data, variable length nonces, and variable length authentication tags. Users who require such functionality should investigate the one-shot Encrypt/Decrypt calls instead.
func (*AeadAEZ) NonceSize ¶
NonceSize returns the size of the nonce that must be passed to Seal and Open.
func (*AeadAEZ) Open ¶
Open decrypts and authenticates ciphertext, authenticates the additional data and, if successful, appends the resulting plaintext to dst, returning the updated slice. The nonce must be NonceSize() bytes long and both it and the additional data must match the value passed to Seal.
func (*AeadAEZ) Overhead ¶
Overhead returns the maximum difference between the lengths of a plaintext and its ciphertext.
func (*AeadAEZ) Reset ¶
func (a *AeadAEZ) Reset()
Reset clears the sensitive keying material from the datastructure such that it will no longer be in memory.
func (*AeadAEZ) Seal ¶
Seal encrypts and authenticates plaintext, authenticates the additional data and appends the result to dst, returning the updated slice. The nonce must be NonceSize() bytes long.
The nonce additionally should be unique for all time, for a given key, however the AEZ primitive does provide nonce-reuse misuse-resistance, see the paper for more details (MRAE).