aead

package
v0.0.0-...-0941746 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 18, 2024 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
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

func DecryptWithNonce(key, nonce, ciphertext, additionalData []byte) (plaintext []byte, err error)

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

func EncryptWithNonce(key, plaintext, additionalData []byte) (ciphertext, nonce []byte, err error)

Encrypt is an helper function to symetrically encrypt a piece of data using AES-256-GCM returning the nonce separatly

func NewAes256Gcm

func NewAes256Gcm(key []byte) (aeadCipher cipher.AEAD, err error)

NewAEAD returns a AES-256-GCM AEAD that uses the given 256-bit key.

func NewAes256GcmKey

func NewAes256GcmKey() ([]byte, error)

NewAes256GcmKey generates a new random secret key.

func NewAes256GcmNonce

func NewAes256GcmNonce() ([]byte, error)

NewAes256GcmKey generates a new random nonce.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL