Documentation ¶
Overview ¶
Package aead provides subtle implementations of the Aead primitive.
Index ¶
Constants ¶
const ( // AesGcmIvSize is the only IV size that this implementation supports. AesGcmIvSize = 12 // AesGcmTagSize is the only tag size that this implementation supports. AesGcmTagSize = 16 )
Variables ¶
This section is empty.
Functions ¶
func ValidateAesKeySize ¶
ValidateAesKeySize checks if the given key size is a valid AES key size.
Types ¶
type AesGcm ¶
type AesGcm struct {
Key []byte
}
AesGcm is an implementation of Aead interface.
func NewAesGcm ¶
NewAesGcm returns an AesGcm instance. The key argument should be the AES key, either 16, 24, or 32 bytes to select AES-128, AES-192, or AES-256.
func (*AesGcm) Decrypt ¶
Decrypt decrypts {@code ct} with {@code aad} as the additionalauthenticated data.
func (*AesGcm) Encrypt ¶
Encrypt encrypts {@code pt} with {@code aad} as additional authenticated data. The resulting ciphertext consists of two parts: (1) the IV used for encryption and (2) the actual ciphertext.
Note: AES-GCM implementation of crypto library always returns ciphertext with 128-bit tag.