aesx

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decrypt added in v1.1.9

func Decrypt(alg AesAlg, key []byte, encryptedData []byte) ([]byte, error)

func Encrypt added in v1.1.9

func Encrypt(alg AesAlg, key []byte, plainData []byte) ([]byte, error)

func GenerateRandomIV

func GenerateRandomIV(b []byte) error

func PKCS5Padding

func PKCS5Padding(plainText []byte) []byte

func PKCS5UnPadding

func PKCS5UnPadding(src []byte) ([]byte, error)

Types

type AES

type AES[T interface{ *struct{} | any }, A cipher.Block] struct {
	// contains filtered or unexported fields
}

func AESChiper

func AESChiper[A cipher.Block](aesFunc AESFunc[A], data string, alg AesAlg) AES[string, A]

func AESCipherJSON added in v1.4.8

func AESCipherJSON[A cipher.Block, T any](aesFunc AESFunc[A], data T, alg AesAlg) AES[T, A]

func (AES[T, A]) GormDataType added in v1.4.9

func (AES[T, A]) GormDataType() string

func (*AES[T, A]) Scan

func (s *AES[T, A]) Scan(src any) (err error)

func (AES[T, A]) To

func (s AES[T, A]) To() T

func (AES[T, A]) ToP

func (s AES[T, A]) ToP() *T

func (AES[T, A]) Value

func (s AES[T, A]) Value() (driver.Value, error)

type AESDataType added in v1.4.9

type AESDataType struct{}

func (AESDataType) GormDBDataType added in v1.4.9

func (AESDataType) GormDBDataType(db *gorm.DB, field *schema.Field) string

type AESFunc

type AESFunc[A cipher.Block] func() (A, error)

type AesAlg

type AesAlg string
const (
	AesCBC AesAlg = "cbc"

	AesCFB AesAlg = "cfb"

	AesGCM AesAlg = "gcm"
)

Jump to

Keyboard shortcuts

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