public class WXBizMsgCrypt extends Object
| Modifier and Type | Method and Description |
|---|---|
static String |
decrypt(String text,
WeiXinConfig wxConf)
对密文进行解密.
|
static String |
decryptMsg(String msgSignature,
String timeStamp,
String nonce,
String postData,
WeiXinConfig wxConf)
检验消息的真实性,并且获取解密后的明文.
|
static String |
encrypt(String randomStr,
String text,
WeiXinConfig wxConf)
对明文进行加密.
|
static String |
encryptMsg(String replyMsg,
String timeStamp,
String nonce,
WeiXinConfig wxConf)
将公众平台回复用户的消息加密打包.
|
static String |
verifyUrl(String msgSignature,
String timeStamp,
String nonce,
String echoStr,
WeiXinConfig wxConf)
验证URL
|
public static String encrypt(String randomStr, String text, WeiXinConfig wxConf) throws AesException
text - 需要加密的明文AesException - aes加密失败public static String decrypt(String text, WeiXinConfig wxConf) throws AesException
text - 需要解密的密文AesException - aes解密失败public static String encryptMsg(String replyMsg, String timeStamp, String nonce, WeiXinConfig wxConf) throws AesException
replyMsg - 公众平台待回复用户的消息,xml格式的字符串timeStamp - 时间戳,可以自己生成,也可以用URL参数的timestampnonce - 随机串,可以自己生成,也可以用URL参数的nonceAesException - 执行失败,请查看该异常的错误码和具体的错误信息public static String decryptMsg(String msgSignature, String timeStamp, String nonce, String postData, WeiXinConfig wxConf) throws AesException
msgSignature - 签名串,对应URL参数的msg_signaturetimeStamp - 时间戳,对应URL参数的timestampnonce - 随机串,对应URL参数的noncepostData - 密文AesException - 执行失败,请查看该异常的错误码和具体的错误信息public static String verifyUrl(String msgSignature, String timeStamp, String nonce, String echoStr, WeiXinConfig wxConf) throws AesException
msgSignature - 签名串,对应URL参数的msg_signaturetimeStamp - 时间戳,对应URL参数的timestampnonce - 随机串,对应URL参数的nonceechoStr - 随机串,对应URL参数的echostrAesException - 执行失败,请查看该异常的错误码和具体的错误信息Copyright © 2012–2020 Wudao Software Studio. All rights reserved.