Package gcm

Package gcm implements the Galois/Counter Mode of Operation (GCM) for block ciphers.

Constants

const NonceSize = 12

NonceSize specifies the nonce size in bytes.

const TagSize = 16

TagSize specifies the tag size in bytes.

Variables

This section is empty.

Functions

func DecryptAES128
func DecryptAES128(key [16]byte, nonce [NonceSize]byte, ciphertext, additionalData []byte) ([]byte, bool)

DecryptAES128 decrypts the ciphertext in AES-GCM mode. They key specifies the AES encryption key and nonce is an unique initialization vector; the nonce must not be reused for the same encryption key. The additionalData specifies additional data that is was authenticated but not encrypted when the ciphertext was created.

func EncryptAES128
func EncryptAES128(key [16]byte, nonce [NonceSize]byte, plaintext, additionalData []byte) []byte

EncryptAES128 encrypts the plaintext in AES-GCM mode. The key specifies the AES encryption key and nonce is an unique initialization vector; the nonce must not be reused for the same encryption key. The additionalData specifies additional data that is authenticated but not encrypted. The input plaintext can be of any length i.e. it don't have to be padded to cipher block size.

Types

This section is empty.