From e5abf0c7f06e584ff6b561c83959cc076de29729 Mon Sep 17 00:00:00 2001 From: duhui Date: Thu, 14 Jul 2022 09:45:29 +0800 Subject: [PATCH] =?UTF-8?q?=E7=96=AF=E4=BD=93ios=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E6=94=AF=E4=BB=98paykey?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/FengTiIosRechargeController.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/jmfy/controller/FengTiIosRechargeController.java b/src/main/java/com/jmfy/controller/FengTiIosRechargeController.java index e88ab65..0e01142 100644 --- a/src/main/java/com/jmfy/controller/FengTiIosRechargeController.java +++ b/src/main/java/com/jmfy/controller/FengTiIosRechargeController.java @@ -25,7 +25,7 @@ public class FengTiIosRechargeController { private static final Logger LOGGER = LoggerFactory.getLogger(FengTiIosRechargeController.class); private static final String callbackkey = "53780900079388195716762718742907"; - private static final String publicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDmJHw+qP7vzf+QyL2/AC+dItwDMcoClG5csqiUgL6vl4801HogkBGHI9eQZuFqwJKJENoIkPA5apuitGJIor4CaomqiuWHMY+oIywPP+hXelcxzVDf8nx8XWe2f8WVbHlfI9EL40cvcijl5xv2xXGfxqFwvWzbC+64nszfD1HiewIDAQAB"; + private static final String payKey = "2e92cbb7faa7e37e0c5a38723b1d2acd"; @RequestMapping(value = "/FengTiIosCallback") public String FengTiIoCallback(HttpServletRequest request) throws Exception { @@ -77,9 +77,9 @@ public class FengTiIosRechargeController { String substring = builder.substring(0, builder.length() - 1); try { // 2、生成签名 - return verify(publicKey,substring,sign); + return verify(payKey,substring,sign); } catch (Exception e) { - LOGGER.error("疯体ios待签名字符串================>publicKey:{},signedData:{},signature:{}",publicKey,substring,sign); + LOGGER.error("疯体ios待签名字符串================>publicKey:{},signedData:{},signature:{}", payKey,substring,sign); } return false; } @@ -88,16 +88,15 @@ public class FengTiIosRechargeController { X509EncodedKeySpec keySpecX509 = new X509EncodedKeySpec(Base64.getDecoder().decode(pubKeyStr)); KeyFactory kf = KeyFactory.getInstance("RSA"); RSAPublicKey pubKey = (RSAPublicKey) kf.generatePublic(keySpecX509); - - System.out.println("parse key success"); + LOGGER.info("parse key success"); try { Signature sig; sig = Signature.getInstance("SHA1withRSA"); sig.initVerify(pubKey); - System.out.println("initVerify success"); + LOGGER.info("initVerify success"); // sig.update(signedData.getBytes()); sig.update(Base64.getDecoder().decode(Base64.getEncoder().encode(signedData.getBytes()))); - System.out.println("update success"); + LOGGER.info("update success"); if (!sig.verify(Base64.getDecoder().decode(signature.getBytes()))) { return false;