aes

package
v0.0.0-...-d5572aa Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const KeyLength = 32

KeyLength is the recommended length of the AES key.

Variables

This section is empty.

Functions

func Decrypt

func Decrypt(ciphertext, key []byte) ([]byte, error)

Decrypt decrypts a base64-encoded byte slice using the given key and initialization vector (IV) contained in the byte slice.

func Encrypt

func Encrypt(plaintext, key []byte) ([]byte, error)

Encrypt encrypts a byte slice using the given key and returns the encrypted byte slice in base64-encoded form, including the initialization vector (IV) used during encryption. The IV is a unique value used in the encryption process to prevent replay attacks.

Types

type Decrypter

type Decrypter struct {
	// contains filtered or unexported fields
}

func NewDecrypter

func NewDecrypter(src io.Reader, dst io.Writer) *Decrypter

func (Decrypter) Decrypt

func (d Decrypter) Decrypt(key []byte) error

Decrypt decrypts data from src and writes it to dst.

type Encrypter

type Encrypter struct {
	// contains filtered or unexported fields
}

func NewEncrypter

func NewEncrypter(src io.Reader, dst io.Writer) *Encrypter

func (Encrypter) Encrypt

func (e Encrypter) Encrypt(key []byte) error

Encrypt encrypts data from src and writes it to dst.

Jump to

Keyboard shortcuts

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