|
|
@@ -12,6 +12,7 @@ import com.iformall.service.toutiao.api.bean.TtOpenGsonBuilder; |
|
|
|
import com.iformall.service.toutiao.api.bean.TtOpenRetrieveCode; |
|
|
|
import com.iformall.service.toutiao.api.bean.TtOpenTicket; |
|
|
|
import com.iformall.service.toutiao.utils.MsgDecrypt; |
|
|
|
import com.iformall.service.toutiao.utils.ServerVerification; |
|
|
|
import me.chanjar.weixin.common.error.WxError; |
|
|
|
import me.chanjar.weixin.common.error.WxErrorException; |
|
|
|
import me.chanjar.weixin.common.util.crypto.SHA1; |
|
|
@@ -79,8 +80,9 @@ public class TtOpenComponentServiceImpl implements TtOpenComponentService { |
|
|
|
@Override |
|
|
|
public boolean checkSignature(String timestamp, String nonce, String encrypt, String signature) { |
|
|
|
try { |
|
|
|
return SHA1.gen(getWxOpenConfigStorage().getComponentToken(), timestamp, nonce, encrypt) |
|
|
|
.equals(signature); |
|
|
|
ServerVerification verification = new ServerVerification(); |
|
|
|
String newMsgSignature = verification.getMsgSignature(getWxOpenConfigStorage().getComponentToken(),timestamp, nonce, encrypt); |
|
|
|
return verification.verify(signature,newMsgSignature); |
|
|
|
} catch (Exception e) { |
|
|
|
this.log.error("Checking signature failed, and the reason is :" + e.getMessage()); |
|
|
|
return false; |
|
|
|