aes

package
v5.1.3 Latest Latest
Warning

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

Go to latest
Published: May 5, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package aes is a wrapped for AES/ECB/PKCS5PADDING

Index

Constants

This section is empty.

Variables

View Source
var ErrBlockError = fmt.Errorf("cipher text is not a multiple of the block size")
View Source
var ErrIVLengthMismatch = fmt.Errorf("IV length is not matching with block size")
View Source
var ErrInvalidKeyLength = fmt.Errorf("invalid key length")

Functions

This section is empty.

Types

type CBC

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

func NewCBC

func NewCBC(ctx context.Context, log log.Log, key string, padder crypto.Padder, iv []byte) (*CBC, error)

func NewCBCPKCS7

func NewCBCPKCS7(ctx context.Context, log log.Log, key string, iv []byte) (*CBC, error)

func (*CBC) Decrypt

func (a *CBC) Decrypt(ctx context.Context, encryptedData []byte) (plainData []byte, err error)

func (*CBC) DecryptString

func (a *CBC) DecryptString(ctx context.Context, encryptedData string) (string, error)

func (*CBC) Encrypt

func (a *CBC) Encrypt(ctx context.Context, plainBlob []byte) ([]byte, error)

func (*CBC) EncryptString

func (a *CBC) EncryptString(ctx context.Context, data string) (string, error)

type ECB

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

func NewECB

func NewECB(ctx context.Context, key []byte, log log.Log, padder crypto.Padder) (*ECB, error)

func NewECBPKC5

func NewECBPKC5(ctx context.Context, key []byte, log log.Log) (*ECB, error)

func (*ECB) Decrypt

func (a *ECB) Decrypt(ctx context.Context, data []byte) ([]byte, error)

func (*ECB) Encrypt

func (a *ECB) Encrypt(ctx context.Context, data []byte) ([]byte, error)

func (*ECB) EncryptString

func (a *ECB) EncryptString(ctx context.Context, plainText string) (string, error)

type GCM

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

func NewGCM

func NewGCM(ctx context.Context, log log.Log, key string) (*GCM, error)

func (*GCM) Decrypt

func (a *GCM) Decrypt(ctx context.Context, encryptedData []byte) (plainData []byte, err error)

func (*GCM) DecryptString

func (a *GCM) DecryptString(ctx context.Context, encryptedText string) (string, error)

func (*GCM) Encrypt

func (a *GCM) Encrypt(ctx context.Context, plainBlob []byte) ([]byte, error)

func (*GCM) EncryptString

func (a *GCM) EncryptString(ctx context.Context, plainText string) (string, error)

Jump to

Keyboard shortcuts

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