public class WXBizMsgCrypt extends Object
构造器和说明 |
---|
WXBizMsgCrypt(String token,
String encodingAesKey,
String appId)
构造函数
|
限定符和类型 | 方法和说明 |
---|---|
String |
decryptMsg(String msgSignature,
String timeStamp,
String nonce,
String postData)
检验消息的真实性,并且获取解密后的明文.
|
String |
encryptMsg(String replyMsg,
String timeStamp,
String nonce)
将公众平台回复用户的消息加密打包.
|
String |
verifyUrl(String msgSignature,
String timeStamp,
String nonce,
String echoStr)
验证URL
|
public WXBizMsgCrypt(String token, String encodingAesKey, String appId) throws AesException
token
- 公众平台上,开发者设置的tokenencodingAesKey
- 公众平台上,开发者设置的EncodingAESKeyappId
- 公众平台appidAesException
- 执行失败,请查看该异常的错误码和具体的错误信息public String encryptMsg(String replyMsg, String timeStamp, String nonce) throws AesException
replyMsg
- 公众平台待回复用户的消息,xml格式的字符串timeStamp
- 时间戳,可以自己生成,也可以用URL参数的timestampnonce
- 随机串,可以自己生成,也可以用URL参数的nonceAesException
- 执行失败,请查看该异常的错误码和具体的错误信息public String decryptMsg(String msgSignature, String timeStamp, String nonce, String postData) throws AesException
msgSignature
- 签名串,对应URL参数的msg_signaturetimeStamp
- 时间戳,对应URL参数的timestampnonce
- 随机串,对应URL参数的noncepostData
- 密文,对应POST请求的数据AesException
- 执行失败,请查看该异常的错误码和具体的错误信息public String verifyUrl(String msgSignature, String timeStamp, String nonce, String echoStr) throws AesException
msgSignature
- 签名串,对应URL参数的msg_signaturetimeStamp
- 时间戳,对应URL参数的timestampnonce
- 随机串,对应URL参数的nonceechoStr
- 随机串,对应URL参数的echostrAesException
- 执行失败,请查看该异常的错误码和具体的错误信息Copyright © 2017. All rights reserved.