Documentation ¶
Index ¶
Constants ¶
const MaxAssociatedDataItems = 126
MaxAssociatedDataItems is the maximum number of associated data items
Variables ¶
var ( // ErrNotAuthentic indicates a ciphertext is malformed or corrupt ErrNotAuthentic = errors.New("siv: authentication failed") // ErrTooManyAssociatedDataItems indicates more than MaxAssociatedDataItems were given ErrTooManyAssociatedDataItems = errors.New("siv: too many associated data items") )
Functions ¶
func NewCMAC ¶
NewCMAC returns an SIV instance implementing cipher.AEAD interface
Unless the given nonce size is less than zero, Seal and Open will panic when passed nonce of a different size.
Types ¶
type Cipher ¶
type Cipher struct {
// contains filtered or unexported fields
}
Cipher is an instance of AES-SIV, configured with either AES-CMAC or AES-PMAC as a message authentication code.
func NewCMACCipher ¶
NewCMACCipher returns a new SIV cipher.
func NewPMACCipher ¶
NewPMACCipher returns a new SIV cipher.
func (*Cipher) Open ¶
Open decrypts ciphertext, authenticates the decrypted plaintext and the given associated data items and, if successful, appends the resulting plaintext to dst, returning the updated slice. The additional data items must match the items passed to Seal.
The ciphertext and dst may alias exactly or not at all.
For nonce-based encryption, the nonce should be the last associated data item.
func (*Cipher) Seal ¶
Seal encrypts and authenticates plaintext, authenticates the given associated data items, and appends the result to dst, returning the updated slice.
The plaintext and dst may alias exactly or not at all.
For nonce-based encryption, the nonce should be the last associated data item.