Documentation ¶
Index ¶
- Constants
- func AESDecryptMsg(ciphertext []byte, aesKey []byte) (random, rawXMLMsg, appID []byte, err error)
- func AESEncryptMsg(random, rawXMLMsg []byte, appID string, aesKey []byte) (ciphertext []byte)
- func AesECBDecrypt(ciphertext []byte, aesKey []byte) ([]byte, error)
- func CalculateSign(content, signType, key string) (string, error)
- func DecryptMsg(appID, encryptedMsg, aesKey string) (random, rawMsgXMLBytes []byte, err error)
- func EncryptMsg(random, rawXMLMsg []byte, appID, aesKey string) (encrtptMsg []byte, err error)
- func HTTPGet(uri string) ([]byte, error)
- func HTTPPost(uri string, data string) ([]byte, error)
- func InMicroMessenger(userAgent string) bool
- func NewECBDecryptor(b cipher.Block) cipher.BlockMode
- func NewECBEncryptor(b cipher.Block) cipher.BlockMode
- func OrderParam(p map[string]string, bizKey string) (returnStr string)
- func PKCS5Padding(ciphertext []byte, blockSize int) []byte
- func PKCS5UnPadding(origData []byte) []byte
- func ParamSign(p map[string]string, key string) (string, error)
- func PostJSON(url string, object interface{}) ([]byte, error)
- func Signature(x ...string) string
- func TryDecodeError(data []byte, apiName string) (err error)
- type ECBDecryptor
- type ECBEncryptor
- type WechatError
Constants ¶
const ( SignTypeMD5 = `MD5` SignTypeHMACSHA256 = `HMAC-SHA256` )
微信签名算法方式
Variables ¶
This section is empty.
Functions ¶
func AESDecryptMsg ¶
AESDecryptMsg ciphertext = AES_Encrypt[random(16B) + msg_len(4B) + rawXMLMsg + appId] 参考:github.com/chanxuehong/wechat.v2
func AESEncryptMsg ¶
AESEncryptMsg ciphertext = AES_Encrypt[random(16B) + msg_len(4B) + rawXMLMsg + appId] 参考:github.com/chanxuehong/wechat.v2
func AesECBDecrypt ¶
AesECBDecrypt will decrypt data with PKCS5Padding
func CalculateSign ¶
CalculateSign 计算签名
func DecryptMsg ¶
DecryptMsg 消息解密
func EncryptMsg ¶
EncryptMsg 加密消息
func NewECBDecryptor ¶
NewECBDecryptor returns a BlockMode which decrypts in electronic code book mode, using the given Block.
func NewECBEncryptor ¶
NewECBEncryptor returns a BlockMode which encrypts in electronic code book mode, using the given Block.
func OrderParam ¶
OrderParam order params
func TryDecodeError ¶
TryDecodeError 尝试解码响应错误。
Types ¶
type ECBDecryptor ¶
type ECBDecryptor ecb
ECBDecryptor -
func (*ECBDecryptor) BlockSize ¶
func (x *ECBDecryptor) BlockSize() int
BlockSize implement BlockMode.BlockSize
func (*ECBDecryptor) CryptBlocks ¶
func (x *ECBDecryptor) CryptBlocks(dst, src []byte)
CryptBlocks implement BlockMode.CryptBlocks
type ECBEncryptor ¶
type ECBEncryptor ecb
ECBEncryptor -
func (*ECBEncryptor) BlockSize ¶
func (x *ECBEncryptor) BlockSize() int
BlockSize implement BlockMode.BlockSize
func (*ECBEncryptor) CryptBlocks ¶
func (x *ECBEncryptor) CryptBlocks(dst, src []byte)
CryptBlocks implement BlockMode.CryptBlocks
type WechatError ¶
WechatError 是微信接口通用错误结构体。
func (*WechatError) Success ¶
func (e *WechatError) Success() bool