Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MockEncryptor ¶
type MockEncryptor struct {
Serial string
}
MockEncryptor 模拟字符串加密器
func (*MockEncryptor) Encrypt ¶
func (e *MockEncryptor) Encrypt(ctx context.Context, serial, plaintext string) (ciphertext string, err error)
Encrypt 使用指定证书进行字符串加密
func (*MockEncryptor) SelectCertificate ¶
func (e *MockEncryptor) SelectCertificate(ctx context.Context) (serial string, err error)
SelectCertificate 模拟选择加密用证书
type WechatPayEncryptor ¶
type WechatPayEncryptor struct {
// contains filtered or unexported fields
}
WechatPayEncryptor 微信支付字符串加密器,使用微信支付平台证书
func NewWechatPayEncryptor ¶
func NewWechatPayEncryptor(certProvider core.CertificateGetter) *WechatPayEncryptor
NewWechatPayEncryptor 新建一个 WechatPayEncryptor
func (*WechatPayEncryptor) Encrypt ¶
func (e *WechatPayEncryptor) Encrypt( ctx context.Context, serial, plaintext string) (ciphertext string, err error)
Encrypt 对字符串加密
func (*WechatPayEncryptor) SelectCertificate ¶
func (e *WechatPayEncryptor) SelectCertificate(ctx context.Context) (serial string, err error)
SelectCertificate 选择合适的微信支付平台证书用于加密 根据微信支付平台证书文档说明,应优先使用最新的证书(即启用时间最晚) https://wechatpay-api.gitbook.io/wechatpay-api-v3/jie-kou-wen-dang/ping-tai-zheng-shu#zhu-yi-shi-xiang
type WechatPayPubKeyEncryptor ¶ added in v0.2.20
type WechatPayPubKeyEncryptor struct {
// contains filtered or unexported fields
}
WechatPayPubKeyEncryptor 微信支付字符串加密器,使用微信支付公钥
func NewWechatPayPubKeyEncryptor ¶ added in v0.2.20
func NewWechatPayPubKeyEncryptor(keyID string, publicKey rsa.PublicKey) *WechatPayPubKeyEncryptor
NewWechatPayPubKeyEncryptor 新建一个 WechatPayPubKeyEncryptor
func (*WechatPayPubKeyEncryptor) Encrypt ¶ added in v0.2.20
func (e *WechatPayPubKeyEncryptor) Encrypt(ctx context.Context, serial, plaintext string) (ciphertext string, err error)
Encrypt 对字符串加密
func (*WechatPayPubKeyEncryptor) SelectCertificate ¶ added in v0.2.20
func (e *WechatPayPubKeyEncryptor) SelectCertificate(ctx context.Context) (serial string, err error)
SelectCertificate 选择合适的微信支付平台证书用于加密 返回公钥对应的 KeyId 作为证书序列号
Click to show internal directories.
Click to hide internal directories.