kernel

package
v2.2.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2021 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AESDecrypt

func AESDecrypt(crypted, key []byte) []byte

解密

func AESEncrypt

func AESEncrypt(origData, key []byte) []byte

加密

func AesDecrypt

func AesDecrypt(cipherText string, encryptKey string)

func AesEncrypt

func AesEncrypt(plainText string, encryptKey string)

func ExtractAlipayPublicKey

func ExtractAlipayPublicKey(alipayPublicKey string) string

func GetAlipayCertSN

func GetAlipayCertSN(alipayCertSN map[string]string) string

func GetAlipayRootCertSN

func GetAlipayRootCertSN() string

func GetConfig

func GetConfig(key string) string

func GetMerchantCertSN

func GetMerchantCertSN() string

func GetSdkVersion

func GetSdkVersion() string

func GetTimestamp

func GetTimestamp() string

* 获取时间戳,格式yyyy-MM-dd HH:mm:ss

func InitClient

func InitClient(config Client)

func IsCertMode

func IsCertMode() bool

func PKCS7Padding

func PKCS7Padding(origData []byte, blockSize int) []byte

补码

func PKCS7UnPadding

func PKCS7UnPadding(origData []byte) []byte

去补码

func ReadAsJson

func ReadAsJson(response io.Reader, method string) (map[string]string, error)

* 解析网关响应内容,同时将API的接口名称和响应原文插入到响应数组的method和body字段中

func RsaSignWithSha256

func RsaSignWithSha256(data []byte, keyBytes []byte) []byte

签名

func RsaVerySignWithSha256

func RsaVerySignWithSha256(data, signData, keyBytes []byte) bool

验证

func Sign

func Sign(systemParams map[string]string, bizParams map[string]string, textParams map[string]string, privateKey string) string

* 计算签名

func SortMap

func SortMap(romanNumeralDict map[string]string) map[string]string

func ToRespModel

func ToRespModel(resp map[string]string) map[string]interface{}

func ToUrlEncodedRequestBody

func ToUrlEncodedRequestBody(bizParams map[string]string) string

* 将业务参数和其他额外文本参数按www-form-urlencoded格式转换成HTTP Body中的字节数组,注意要做URL Encode

func Verify

func Verify(respMap map[string]string, alipayPublicKey string) bool

Types

type AlipayOpenApiGenericResponse

type AlipayOpenApiGenericResponse struct {
	HttpBody *string `json:"http_body" xml:"http_body" require:"true"`
	Code     *string `json:"code" xml:"code" require:"true"`
	Msg      *string `json:"msg" xml:"msg" require:"true"`
	SubCode  *string `json:"sub_code" xml:"sub_code" require:"true"`
	SubMsg   *string `json:"sub_msg" xml:"sub_msg" require:"true"`
}

func Execute

func Execute(method string, textParams map[string]string, bizParams map[string]string) (_result *AlipayOpenApiGenericResponse, _err error)

func (AlipayOpenApiGenericResponse) GoString

func (s AlipayOpenApiGenericResponse) GoString() string

func (*AlipayOpenApiGenericResponse) SetCode

func (*AlipayOpenApiGenericResponse) SetHttpBody

func (*AlipayOpenApiGenericResponse) SetMsg

func (*AlipayOpenApiGenericResponse) SetSubCode

func (*AlipayOpenApiGenericResponse) SetSubMsg

func (AlipayOpenApiGenericResponse) String

type Client

type Client struct {
	Protocol           string
	GatewayHost        string
	AppId              string
	SignType           string
	AlipayPublicKey    string
	MerchantPrivateKey string
	MerchantCertPath   string
	AlipayCertPath     string
	AlipayRootCertPath string
	NotifyUrl          string
	EncryptKey         string
	MerchantCertSN     string
	AlipayCertSN       string
	AlipayRootCertSN   string
}

func NewClient

func NewClient() (*Client, error)

func (*Client) Init

func (client *Client) Init() (_err error)

Jump to

Keyboard shortcuts

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