mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-10-29 01:18:36 +08:00
🎨 增加对象自身的解密方法,调整解密工具类方法名
This commit is contained in:
@ -506,7 +506,6 @@ public class WxMpXmlMessage implements Serializable {
|
||||
@JacksonXmlProperty(localName = "ReceiptInfo")
|
||||
private String receiptInfo;
|
||||
|
||||
|
||||
///////////////////////////////////////
|
||||
// 门店审核事件推送
|
||||
///////////////////////////////////////
|
||||
@ -797,6 +796,12 @@ public class WxMpXmlMessage implements Serializable {
|
||||
@JacksonXmlProperty(localName = "nsrsbh")
|
||||
private String nsrsbh;
|
||||
|
||||
/**
|
||||
* 加密消息
|
||||
*/
|
||||
@XStreamAlias("Encrypt")
|
||||
@JacksonXmlProperty(localName = "Encrypt")
|
||||
private String encrypt;
|
||||
|
||||
public static WxMpXmlMessage fromXml(String xml) {
|
||||
//修改微信变态的消息内容格式,方便解析
|
||||
@ -836,6 +841,14 @@ public class WxMpXmlMessage implements Serializable {
|
||||
}
|
||||
}
|
||||
|
||||
public WxMpXmlMessage decryptField(WxMpConfigStorage wxMpConfigStorage,
|
||||
String timestamp, String nonce, String msgSignature) {
|
||||
WxMpCryptUtil cryptUtil = new WxMpCryptUtil(wxMpConfigStorage);
|
||||
String plainText = cryptUtil.decryptContent(msgSignature, timestamp, nonce, this.encrypt);
|
||||
log.debug("解密后的原始xml消息内容:{}", plainText);
|
||||
return fromXml(plainText);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 当接受用户消息时,可能会获得以下值:
|
||||
|
||||
Reference in New Issue
Block a user