xaes

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AesDecryptCBC

func AesDecryptCBC(ciphertext []byte, key, iv []byte) (plaintext []byte)

func AesEncryptCBC

func AesEncryptCBC(plaintext []byte, key, iv []byte) (ciphertext []byte)

Types

type CiphertextBase64

type CiphertextBase64 struct{}

func (*CiphertextBase64) Decode

func (c *CiphertextBase64) Decode(b []byte) ([]byte, error)

func (*CiphertextBase64) Encode

func (c *CiphertextBase64) Encode(b []byte) ([]byte, error)

type CiphertextCoder

type CiphertextCoder interface {
	Encode([]byte) ([]byte, error)
	Decode([]byte) ([]byte, error)
}

密文编码器

type PKCS7Pading

type PKCS7Pading struct{}

func (*PKCS7Pading) Pading

func (p *PKCS7Pading) Pading(plaintext []byte) []byte

func (*PKCS7Pading) UnPading

func (p *PKCS7Pading) UnPading(plaintext []byte) []byte

type Padinger

type Padinger interface {
	Pading([]byte) []byte
	UnPading([]byte) []byte
}

type SetOption

type SetOption func(*XAES)

func SetAES128

func SetAES128() SetOption

func SetAES192

func SetAES192() SetOption

func SetAES256

func SetAES256() SetOption

func SetCiphertextBase64

func SetCiphertextBase64() SetOption

加密结果使用base64编码

func SetCiphertextNil

func SetCiphertextNil() SetOption

加密结果不编码

func SetIv

func SetIv(iv []byte) SetOption

func SetPaddinger

func SetPaddinger(p Padinger) SetOption

type XAES

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

func NewAES

func NewAES(options ...SetOption) *XAES

func (*XAES) Decrypt

func (x *XAES) Decrypt(key, ciphertext []byte, options ...SetOption) ([]byte, error)

解密

func (*XAES) Encrypt

func (x *XAES) Encrypt(key, plaintext []byte, options ...SetOption) ([]byte, error)

加密

type ZeroPading

type ZeroPading struct{}

func (*ZeroPading) Pading

func (p *ZeroPading) Pading(plaintext []byte) []byte

func (*ZeroPading) UnPading

func (p *ZeroPading) UnPading(plaintext []byte) []byte

Jump to

Keyboard shortcuts

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