Documentation
¶
Overview ¶
aes.go
sha1.go
small.go
Index ¶
- Variables
- func AesCBCDecrypt(session_key, encryptedData, iv string) (plaintext []byte, err error)
- func CheckSignature(signature, session_key, rawData string) bool
- func PKCS5UnPadding(plaintext []byte, blockSize int) ([]byte, error)
- func Sha1(key string) string
- type ErrInfo
- type HttpRequest
- type StepInfo
- type Watermark
- type WeRunData
- type Wx
- type WxPhoneNumber
- type WxSesstion
- type WxUserInfo
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrPaddingSize = errors.New("padding size error")
)
Functions ¶
func AesCBCDecrypt ¶
接口返回的加密数据( encryptedData )进行对称解密。 解密算法如下: 对称解密使用的算法为 AES-128-CBC,数据采用PKCS#7填充。 对称解密的目标密文为 Base64_Decode(encryptedData)。 对称解密秘钥 aeskey = Base64_Decode(session_key), aeskey 是16字节。 对称解密算法初始向量 为Base64_Decode(iv),其中iv由数据接口返回。 AES并没有64位的块, 如果采用PKCS5, 那么实质上就是采用PKCS7
func CheckSignature ¶
检验signature是否相同
func PKCS5UnPadding ¶
Types ¶
type HttpRequest ¶
type HttpRequest struct {
// contains filtered or unexported fields
}
func NewRequest ¶
func NewRequest(method, url string, body io.Reader) *HttpRequest
func (*HttpRequest) Bytes ¶
func (m *HttpRequest) Bytes() ([]byte, error)
func (*HttpRequest) ToJson ¶
func (m *HttpRequest) ToJson(v interface{}) error
type WeRunData ¶
type WeRunData struct {
StepInfoList []*StepInfo `json:"stepInfoList"`
}
func GetWeRunData ¶
获取用户过去三十天微信运动步数
type Wx ¶
func (*Wx) GetWxSessionKey ¶
func (wx *Wx) GetWxSessionKey(code string) (ws WxSesstion, err error)
"https://api.weixin.qq.com/sns/jscode2session? appid=APPID&secret=SECRET&js_code=JSCODE&grant_type=authorization_code 根据code获取WxSesstion
type WxPhoneNumber ¶
type WxPhoneNumber struct { PhoneNumber string `json:"phoneNumber"` //用户绑定的手机号(国外手机号会有区号) PurePhoneNumber string `json:"purePhoneNumber"` //没有区号的手机号 CountryCode string `json:"countryCode"` //区号 Watermark *Watermark `json:"watermark"` //数据水印( watermark ) }
func GetPhoneNumber ¶
func GetPhoneNumber(session_key, encryptedData, iv string) (wpn WxPhoneNumber, err error)
获取微信用户绑定的手机号
type WxSesstion ¶
type WxUserInfo ¶
type WxUserInfo struct { OpenId string `json:"openId"` NickName string `json:"nickName"` Gender int `json:"gender"` City string `json:"city"` Province string `json:"province"` Country string `json:"country"` AvatarUrl string `json:"avatarUrl"` UnionId string `json:"unionId"` Watermark *Watermark `json:"watermark"` //数据水印( watermark ) }
微信加密数据结构
func GetWxUserInfo ¶
func GetWxUserInfo(session_key, encryptedData, iv string) (wui WxUserInfo, err error)
根据seesion_key,加密数据encryptedData和向量偏移量iv获取微信用户信息 主要是 敏感信息
Click to show internal directories.
Click to hide internal directories.