Documentation ¶
Index ¶
- Constants
- func Decrypt(cipher cipher.AEAD, key, ciphertext, additionalData []byte) (plaintext []byte, err error)
- func DecryptWithNonce(key, nonce, ciphertext, additionalData []byte) (plaintext []byte, err error)
- func Encrypt(cipher cipher.AEAD, key, plaintext, additionalData []byte) (ciphertext []byte, err error)
- func EncryptWithNonce(key, plaintext, additionalData []byte) (ciphertext, nonce []byte, err error)
- func NewAes256Gcm(key []byte) (aeadCipher cipher.AEAD, err error)
- func NewAes256GcmKey() ([]byte, error)
- func NewAes256GcmNonce() ([]byte, error)
Constants ¶
const ( // Aes256GcmKeySize is the size of the key used by the AES-256-GCM AEAD, in bytes. Aes256GcmKeySize = crypto.Size256 // Aes256GcmNonceSize is the size of the nonce used with the AES-256-GCM // variant of this AEAD, in bytes. Aes256GcmNonceSize = crypto.Size96 )
Variables ¶
This section is empty.
Functions ¶
func Decrypt ¶
func Decrypt(cipher cipher.AEAD, key, ciphertext, additionalData []byte) (plaintext []byte, err error)
DecryptWithNonce is an helper function to symetrically decrypt a piece of data using the provided cipher The nonce should be at the begining of the ciphertext
func DecryptWithNonce ¶
DecryptWithNonce is an helper function to symetrically decrypt a piece of data using AES-256-GCM taking the nonce as a separate piece of input
func Encrypt ¶
func Encrypt(cipher cipher.AEAD, key, plaintext, additionalData []byte) (ciphertext []byte, err error)
Encrypt is an helper function to symetrically encrypt a piece of data using the given cipher the nonce is prepended to the ciphertext in the returned buffer
func EncryptWithNonce ¶
Encrypt is an helper function to symetrically encrypt a piece of data using AES-256-GCM returning the nonce separatly
func NewAes256Gcm ¶
NewAEAD returns a AES-256-GCM AEAD that uses the given 256-bit key.
func NewAes256GcmKey ¶
NewAes256GcmKey generates a new random secret key.
func NewAes256GcmNonce ¶
NewAes256GcmKey generates a new random nonce.
Types ¶
This section is empty.