mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-08-24 16:18:51 +08:00
minor change
This commit is contained in:
parent
0546e001f6
commit
39e79a2c00
@ -1,6 +1,8 @@
|
|||||||
package me.chanjar.weixin.common.bean.result;
|
package me.chanjar.weixin.common.bean.result;
|
||||||
|
|
||||||
import me.chanjar.weixin.common.util.json.WxGsonBuilder;
|
import me.chanjar.weixin.common.util.json.WxGsonBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
@ -50,8 +52,7 @@ public class WxMediaUploadResult implements Serializable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "WxUploadResult [type=" + this.type + ", media_id=" + this.mediaId + ", thumb_media_id=" + this.thumbMediaId
|
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
|
||||||
+ ", created_at=" + this.createdAt + "]";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,24 +1,3 @@
|
|||||||
/**
|
|
||||||
* 对公众平台发送给公众账号的消息加解密示例代码.
|
|
||||||
*
|
|
||||||
* @copyright Copyright (c) 1998-2014 Tencent Inc.
|
|
||||||
* <p>
|
|
||||||
* 针对org.apache.commons.codec.binary.Base64,
|
|
||||||
* 需要导入架包commons-codec-1.9(或commons-codec-1.8等其他版本)
|
|
||||||
* 官方下载地址:http://commons.apache.org/proper/commons-codec/download_codec.cgi
|
|
||||||
* <p>
|
|
||||||
* 针对org.apache.commons.codec.binary.Base64,
|
|
||||||
* 需要导入架包commons-codec-1.9(或commons-codec-1.8等其他版本)
|
|
||||||
* 官方下载地址:http://commons.apache.org/proper/commons-codec/download_codec.cgi
|
|
||||||
*/
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 针对org.apache.commons.codec.binary.Base64,
|
|
||||||
* 需要导入架包commons-codec-1.9(或commons-codec-1.8等其他版本)
|
|
||||||
* 官方下载地址:http://commons.apache.org/proper/commons-codec/download_codec.cgi
|
|
||||||
*/
|
|
||||||
package me.chanjar.weixin.common.util.crypto;
|
package me.chanjar.weixin.common.util.crypto;
|
||||||
|
|
||||||
import org.apache.commons.codec.binary.Base64;
|
import org.apache.commons.codec.binary.Base64;
|
||||||
@ -37,6 +16,14 @@ import java.nio.charset.Charset;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对公众平台发送给公众账号的消息加解密示例代码.
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 1998-2014 Tencent Inc.
|
||||||
|
* 针对org.apache.commons.codec.binary.Base64,
|
||||||
|
* 需要导入架包commons-codec-1.9(或commons-codec-1.8等其他版本)
|
||||||
|
* 官方下载地址:http://commons.apache.org/proper/commons-codec/download_codec.cgi
|
||||||
|
*/
|
||||||
public class WxCryptUtil {
|
public class WxCryptUtil {
|
||||||
|
|
||||||
private static final Base64 base64 = new Base64();
|
private static final Base64 base64 = new Base64();
|
||||||
@ -64,9 +51,9 @@ public class WxCryptUtil {
|
|||||||
/**
|
/**
|
||||||
* 构造函数
|
* 构造函数
|
||||||
*
|
*
|
||||||
* @param token 公众平台上,开发者设置的token
|
* @param token 公众平台上,开发者设置的token
|
||||||
* @param encodingAesKey 公众平台上,开发者设置的EncodingAESKey
|
* @param encodingAesKey 公众平台上,开发者设置的EncodingAESKey
|
||||||
* @param appidOrCorpid 公众平台appid/corpid
|
* @param appidOrCorpid 公众平台appid/corpid
|
||||||
*/
|
*/
|
||||||
public WxCryptUtil(String token, String encodingAesKey,
|
public WxCryptUtil(String token, String encodingAesKey,
|
||||||
String appidOrCorpid) {
|
String appidOrCorpid) {
|
||||||
@ -231,8 +218,7 @@ public class WxCryptUtil {
|
|||||||
* @param encryptedXml 密文,对应POST请求的数据
|
* @param encryptedXml 密文,对应POST请求的数据
|
||||||
* @return 解密后的原文
|
* @return 解密后的原文
|
||||||
*/
|
*/
|
||||||
public String decrypt(String msgSignature, String timeStamp, String nonce,
|
public String decrypt(String msgSignature, String timeStamp, String nonce, String encryptedXml) {
|
||||||
String encryptedXml) {
|
|
||||||
// 密钥,公众账号的app corpSecret
|
// 密钥,公众账号的app corpSecret
|
||||||
// 提取密文
|
// 提取密文
|
||||||
String cipherText = extractEncryptPart(encryptedXml);
|
String cipherText = extractEncryptPart(encryptedXml);
|
||||||
|
Loading…
Reference in New Issue
Block a user