generated from root/miduo_server
疯体ios修改支付paykey
parent
e24e15123c
commit
e5abf0c7f0
|
@ -25,7 +25,7 @@ public class FengTiIosRechargeController {
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(FengTiIosRechargeController.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(FengTiIosRechargeController.class);
|
||||||
private static final String callbackkey = "53780900079388195716762718742907";
|
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")
|
@RequestMapping(value = "/FengTiIosCallback")
|
||||||
public String FengTiIoCallback(HttpServletRequest request) throws Exception {
|
public String FengTiIoCallback(HttpServletRequest request) throws Exception {
|
||||||
|
@ -77,9 +77,9 @@ public class FengTiIosRechargeController {
|
||||||
String substring = builder.substring(0, builder.length() - 1);
|
String substring = builder.substring(0, builder.length() - 1);
|
||||||
try {
|
try {
|
||||||
// 2、生成签名
|
// 2、生成签名
|
||||||
return verify(publicKey,substring,sign);
|
return verify(payKey,substring,sign);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.error("疯体ios待签名字符串================>publicKey:{},signedData:{},signature:{}",publicKey,substring,sign);
|
LOGGER.error("疯体ios待签名字符串================>publicKey:{},signedData:{},signature:{}", payKey,substring,sign);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -88,16 +88,15 @@ public class FengTiIosRechargeController {
|
||||||
X509EncodedKeySpec keySpecX509 = new X509EncodedKeySpec(Base64.getDecoder().decode(pubKeyStr));
|
X509EncodedKeySpec keySpecX509 = new X509EncodedKeySpec(Base64.getDecoder().decode(pubKeyStr));
|
||||||
KeyFactory kf = KeyFactory.getInstance("RSA");
|
KeyFactory kf = KeyFactory.getInstance("RSA");
|
||||||
RSAPublicKey pubKey = (RSAPublicKey) kf.generatePublic(keySpecX509);
|
RSAPublicKey pubKey = (RSAPublicKey) kf.generatePublic(keySpecX509);
|
||||||
|
LOGGER.info("parse key success");
|
||||||
System.out.println("parse key success");
|
|
||||||
try {
|
try {
|
||||||
Signature sig;
|
Signature sig;
|
||||||
sig = Signature.getInstance("SHA1withRSA");
|
sig = Signature.getInstance("SHA1withRSA");
|
||||||
sig.initVerify(pubKey);
|
sig.initVerify(pubKey);
|
||||||
System.out.println("initVerify success");
|
LOGGER.info("initVerify success");
|
||||||
// sig.update(signedData.getBytes());
|
// sig.update(signedData.getBytes());
|
||||||
sig.update(Base64.getDecoder().decode(Base64.getEncoder().encode(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()))) {
|
if (!sig.verify(Base64.getDecoder().decode(signature.getBytes()))) {
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue