ciphers

package
v0.2.12 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type WechatPayCipher

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

WechatPayCipher 提供微信支付敏感信息加解密功能

为了保证通信过程中敏感信息字段(如用户的住址、银行卡号、手机号码等)的机密性,微信支付API v3要求:

  1. 商户对上送的敏感信息字段进行加密
  2. 微信支付对下行的敏感信息字段进行加密

详见:https://wechatpay-api.gitbook.io/wechatpay-api-v3/qian-ming-zhi-nan-1/min-gan-xin-xi-jia-mi

func NewWechatPayCipher

func NewWechatPayCipher(encryptor cipher.Encryptor, decryptor cipher.Decryptor) *WechatPayCipher

NewWechatPayCipher 使用 cipher.Encryptor + cipher.Decryptor 构建一个 WechatPayCipher

func (*WechatPayCipher) Decrypt

func (c *WechatPayCipher) Decrypt(ctx context.Context, in interface{}) error

Decrypt 对结构中的敏感字段进行解密

func (*WechatPayCipher) Encrypt

func (c *WechatPayCipher) Encrypt(ctx context.Context, in interface{}) (string, error)

Encrypt 对结构中的敏感字段进行加密

Jump to

Keyboard shortcuts

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