aes

package
v0.0.0-...-6dc645d Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2024 License: Apache-2.0 Imports: 10 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decrypt

func Decrypt(ctx context.Context, encryptedBytes []byte, aesKeyStr string) (decryptedBytes []byte, err error)

func DecryptCBC

func DecryptCBC(ctx context.Context, cipherText []byte, bKey []byte, bIV []byte) (decryptedString []byte, err error)

func DecryptECB

func DecryptECB(ctx context.Context, encryptedBytes []byte, aesKey []byte) (plainBytes []byte, err error)

func Encrypt

func Encrypt(ctx context.Context, plainBytes []byte, aesKeyStr string) (encryptedBytes []byte, err error)

func EncryptCBC

func EncryptCBC(ctx context.Context, plainText []byte, bKey []byte, bIV []byte) (encryptedString []byte, err error)

func EncryptECB

func EncryptECB(ctx context.Context, plainBytes []byte, aesKey []byte) (encryptedBytes []byte, err error)

func NewECBDecrypter

func NewECBDecrypter(block cipher.Block) cipher.BlockMode

func NewECBEncrypter

func NewECBEncrypter(block cipher.Block) cipher.BlockMode

func Pad

func Pad(buf []byte, size int) []byte

func Unpad

func Unpad(buf []byte) ([]byte, error)

Types

type AesKey

type AesKey struct {
	KeyHex    string `json:"key_string" eru:"required"`
	Key       []byte `json:"key" eru:"required"`
	VectorHex string `json:"iv_string" eru:"required"`
	Vector    []byte `json:"iv" eru:"required"`
	Bits      int    `json:"bits" eru:"required"`
}

func GenerateKey

func GenerateKey(ctx context.Context, bits int) (aesKey AesKey, err error)

Jump to

Keyboard shortcuts

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