Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

企业微信:增加第三方服务商应用消息推送时转换加密的XML格式方法 #2958

Merged
merged 1 commit into from
Mar 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
import me.chanjar.weixin.common.util.xml.XStreamCDataConverter;
import me.chanjar.weixin.cp.bean.outxmlbuilder.*;
import me.chanjar.weixin.cp.config.WxCpConfigStorage;
import me.chanjar.weixin.cp.config.WxCpTpConfigStorage;
import me.chanjar.weixin.cp.util.crypto.WxCpCryptUtil;
import me.chanjar.weixin.cp.util.crypto.WxCpTpCryptUtil;
import me.chanjar.weixin.cp.util.xml.XStreamTransformer;

import java.io.Serializable;
Expand Down Expand Up @@ -141,4 +143,15 @@ public String toEncryptedXml(WxCpConfigStorage wxCpConfigStorage) {
WxCpCryptUtil pc = new WxCpCryptUtil(wxCpConfigStorage);
return pc.encrypt(plainXml);
}

/**
* 企业微信服务商 转换加密的xml 格式
* @param wxCpTpConfigStorage th wx cp tp config storage
* @return the string
*/
public String toEncryptedXml(WxCpTpConfigStorage wxCpTpConfigStorage) {
String plainXml = toXml();
WxCpTpCryptUtil pc = new WxCpTpCryptUtil(wxCpTpConfigStorage);
return pc.encrypt(plainXml);
}
}