aeskit

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PlainType = "PLAIN"
	CBCType   = "CBC"
	CFBType   = "CFB"
	GCMType   = "GCM"
)

Variables

This section is empty.

Functions

func PKCS5Padding added in v1.2.0

func PKCS5Padding(data []byte, blockSize int) []byte

PKCS5Padding 对数据进行PKCS5填充

func PKCS5Unpadding added in v1.2.0

func PKCS5Unpadding(data []byte) ([]byte, error)

PKCS5Unpadding 去除PKCS5填充

func ZeroPadding added in v1.2.0

func ZeroPadding(data []byte, blockSize int) []byte

ZeroPadding 使用ZeroPadding填充数据

func ZeroUnpadding added in v1.2.0

func ZeroUnpadding(data []byte) ([]byte, error)

ZeroUnpadding 去除ZeroPadding填充数据

Types

type AESTemplate added in v1.2.0

type AESTemplate struct {
	Key       []byte
	NonceSize int
	Type      Type
	Encrypter
	Decrypter
}

func (AESTemplate) Decrypt added in v1.2.0

func (t AESTemplate) Decrypt(encrypt []byte) ([]byte, error)

func (AESTemplate) DecryptBase64ToString added in v1.2.0

func (t AESTemplate) DecryptBase64ToString(base64 string) (string, error)

func (AESTemplate) Encrypt added in v1.2.0

func (t AESTemplate) Encrypt(plain []byte) ([]byte, error)

func (AESTemplate) EncryptStringToBase64 added in v1.2.0

func (t AESTemplate) EncryptStringToBase64(plain string) (string, error)

type Decrypter added in v1.2.0

type Decrypter interface {
	Decrypt([]byte) []byte
}

type Encrypter added in v1.2.0

type Encrypter interface {
	Encrypt([]byte) []byte
}

type Type added in v1.2.0

type Type = string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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