aes

package
v0.0.0-...-3d067a8 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2022 License: MIT Imports: 4 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AesGcmKey

func AesGcmKey(key []byte) (cipher.AEAD, error)

AesGcmKey returns a new GCM wrapped AES cipher block; keys should be 16, 24, or 32 bytes in length to select AES-128, AES-192, or AES-256 respectively

func NewKey

func NewKey(key, salt []byte) (cipher.AEAD, []byte, error)

NewKey returns a new GCM wrapped AES cipher block of a PBKDF2 extended key

Types

type EncryptionParams

type EncryptionParams interface {
	// Encrypt encrypts the given plain text and returns its cipher
	Encrypt(plain []byte) []byte

	// Decrypt decrypts the given cipher and returns its plain text
	Decrypt(cipher []byte) ([]byte, error)

	// Nonce (if given) sets the nonce and returns the current nonce
	Nonce(nonce []byte) []byte

	// Salt (if given) sets the salt and returns the current salt
	Salt(salt []byte) []byte
}

EncryptionParams represents an interface to perform symmetric encryption

func NewEncryptionParams

func NewEncryptionParams(key []byte) (EncryptionParams, error)

NewEncryptionParams returns a new EncryptionParams, using the given key to generate the salt and nonce parameters

func NewEncryptionParamsWithValues

func NewEncryptionParamsWithValues(key, salt, nonce []byte) (EncryptionParams, error)

NewEncryptionParamsWithValues returns a new EncryptionParams using the given parameter values

Jump to

Keyboard shortcuts

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