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 DecryptAES256GCM(aesKey, associatedData, nonce, ciphertext string, dest interface{}) 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(url string) ([]byte, error)
- func HttpPost(url string, header http.Header, data []byte) ([]byte, error)
- func HttpPostForm(url string, header http.Header, data map[string]string, files ...File) ([]byte, error)
- func MD5(data string) string
- func NewECBDecryptor(b cipher.Block) cipher.BlockMode
- func NewECBEncryptor(b cipher.Block) cipher.BlockMode
- func PKCS5Padding(ciphertext []byte, blockSize int) []byte
- func PKCS5UnPadding(origData []byte) []byte
- func RandInt(max int) int
- func RandRange(min, max int) (int, bool)
- func RandString(length int) string
- func Sha1(data string) string
- type CDATAInt
- type CDATAStr
- type ECBDecryptor
- type ECBEncryptor
- type File
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 DecryptAES256GCM ¶
DecryptAES256GCM aesKey 密钥 associatedData 附加数据 ciphertext 数据密文 nonce 加密使用的随机串
func DecryptMsg ¶
DecryptMsg 消息解密
func EncryptMsg ¶
EncryptMsg 加密消息
func HttpPostForm ¶
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 RandString ¶
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