cipher

package
v1.2.9 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AesCipher

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

AesCipher aes加密解密

func NewAes

func NewAes(key, iv string) (*AesCipher, error)

NewAes 创建一个新的AesCipher

func (*AesCipher) DecryptBase64

func (a *AesCipher) DecryptBase64(b string) ([]byte, error)

DecryptBase64 解密

func (*AesCipher) EncryptBase64

func (a *AesCipher) EncryptBase64(origData []byte) (string, error)

EncryptBase64 加密

type AesInterface

type AesInterface interface {
	EncryptBase64(in []byte) (string, error)
	DecryptBase64(b string) ([]byte, error)
}

AesInterface aes加密解密接口

type AsymmetricEncryptionConfig added in v1.2.0

type AsymmetricEncryptionConfig struct {
	// 公钥
	PublicKey string `json:"public_key"`
	// 私钥
	PrivateKey string `json:"private_key"`
}

AsymmetricEncryptionConfig 非对称加密配置

func NewAsymmetricEncryptionConfig added in v1.2.0

func NewAsymmetricEncryptionConfig(publicKey, privateKey string) *AsymmetricEncryptionConfig

NewAsymmetricEncryptionConfig 创建非对称加密配置

func (*AsymmetricEncryptionConfig) Scan added in v1.2.0

func (c *AsymmetricEncryptionConfig) Scan(value interface{}) error

Scan 实现gorm的Scan方法

func (*AsymmetricEncryptionConfig) ToConf added in v1.2.0

ToConf 转换为conf.AsymmetricEncryptionConfig

func (*AsymmetricEncryptionConfig) Value added in v1.2.0

Value 实现gorm的Value方法

type SymmetricEncryptionConfig added in v1.2.0

type SymmetricEncryptionConfig struct {
	// 密钥
	Key string `json:"key"`
	// 初始化向量
	Iv string `json:"iv"`
}

SymmetricEncryptionConfig 对称加密配置

func NewSymmetricEncryptionConfig added in v1.2.0

func NewSymmetricEncryptionConfig(key, iv string) *SymmetricEncryptionConfig

NewSymmetricEncryptionConfig 创建对称加密配置

func (*SymmetricEncryptionConfig) Scan added in v1.2.0

func (c *SymmetricEncryptionConfig) Scan(value interface{}) error

Scan 实现gorm的Scan方法

func (*SymmetricEncryptionConfig) ToConf added in v1.2.0

ToConf 转换为conf.SymmetricEncryptionConfig

func (*SymmetricEncryptionConfig) Value added in v1.2.0

Value 实现gorm的Value方法

Jump to

Keyboard shortcuts

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