mirror of
				https://gitee.com/binary/weixin-java-tools.git
				synced 2025-10-31 02:28:25 +08:00 
			
		
		
		
	票据验证方法
This commit is contained in:
		| @ -248,7 +248,6 @@ public class WxCryptUtil { | ||||
|             } | ||||
|         } | ||||
|         toSign.append("key=" + signKey); | ||||
|         System.out.println(toSign.toString()); | ||||
|         String sign = DigestUtils.md5Hex(toSign.toString()) | ||||
|                 .toUpperCase(); | ||||
|         return sign; | ||||
|  | ||||
| @ -11,7 +11,6 @@ import me.chanjar.weixin.mp.bean.result.*; | ||||
| import java.io.File; | ||||
| import java.io.IOException; | ||||
| import java.io.InputStream; | ||||
| import java.math.BigDecimal; | ||||
| import java.text.SimpleDateFormat; | ||||
| import java.util.Date; | ||||
| import java.util.List; | ||||
| @ -738,4 +737,15 @@ public interface WxMpService { | ||||
|      * @return | ||||
|      */ | ||||
|     WxMpPayCallback getJSSDKCallbackData(String xmlData); | ||||
|      | ||||
|     /** | ||||
|      * <pre> | ||||
|      * 计算Map键值对是否和签名相符, | ||||
|      * 按照字段名的 ASCII 码从小到大排序(字典序)后,使用 URL 键值对的 格式(即 key1=value1&key2=value2...)拼接成字符串 | ||||
|      * </pre> | ||||
|      * @param kvm | ||||
|      * @param signature | ||||
|      * @return | ||||
|      */ | ||||
|     public boolean checkJSSDKCallbackDataSignature(Map<String, String> kvm, String signature); | ||||
| } | ||||
|  | ||||
| @ -5,8 +5,6 @@ import java.io.IOException; | ||||
| import java.io.InputStream; | ||||
| import java.io.StringReader; | ||||
| import java.security.NoSuchAlgorithmException; | ||||
| import java.util.ArrayList; | ||||
| import java.util.Collections; | ||||
| import java.util.Date; | ||||
| import java.util.HashMap; | ||||
| import java.util.List; | ||||
| @ -76,7 +74,6 @@ import me.chanjar.weixin.mp.util.http.MaterialVoiceAndImageDownloadRequestExecut | ||||
| import me.chanjar.weixin.mp.util.http.QrCodeRequestExecutor; | ||||
| import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | ||||
|  | ||||
| import org.apache.commons.codec.digest.DigestUtils; | ||||
| import org.apache.http.Consts; | ||||
| import org.apache.http.HttpHost; | ||||
| import org.apache.http.auth.AuthScope; | ||||
| @ -937,5 +934,8 @@ public class WxMpServiceImpl implements WxMpService { | ||||
|     return new WxMpPayCallback(); | ||||
|   } | ||||
|    | ||||
|    | ||||
|   @Override | ||||
|   public boolean checkJSSDKCallbackDataSignature(Map<String, String> kvm, String signature) { | ||||
| 	  return signature.equals(WxCryptUtil.createSign(kvm, wxMpConfigStorage.getPartnerKey())); | ||||
|   } | ||||
| } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 ukid
					ukid