aes

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2021 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateAES128Key

func GenerateAES128Key() ([]byte, error)

GenerateAES128Key returns a 16 bytes key for AES-128

func GenerateAES192Key

func GenerateAES192Key() ([]byte, error)

GenerateAES192Key returns a 24 bytes key for AES-192

func GenerateAES256Key

func GenerateAES256Key() ([]byte, error)

GenerateAES256Key returns a 32 bytes key for AES-256

func NewCBCPKCS5Padding

func NewCBCPKCS5Padding() *cbcPKCS5Padding

NewCBCPKCS5Padding constructs an AES/CBC/PKCS5Padding encryption engine.

Types

type GCM

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

func NewGCM

func NewGCM(options ...GCMOption) *GCM

NewGCM constructs an AES/GCM encryption engine.

func (*GCM) Decrypt

func (e *GCM) Decrypt(base64Key, base64CipherText string) (string, error)

Decrypt returns a decrypted string from AES/GCM base64 cipher text.

func (*GCM) Encrypt

func (e *GCM) Encrypt(base64Key, plainText string) (string, error)

Encrypt returns AES/GCM base64 cipher text. The key argument should be the base64 encoded AES key, either 16, 24, or 32 bytes to select AES-128, AES-192, or AES-256.

type GCMOption

type GCMOption func(*GCM)

GCMOption defines functional option parameters for GCM.

func WithRandReader

func WithRandReader(randReader io.Reader) GCMOption

WithRandReader is a functional option to inject a random reader.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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