|
|
@@ -5,9 +5,13 @@ import java.util.Map;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
|
+import org.apache.log4j.Logger;
|
|
|
import org.springframework.core.io.FileSystemResource;
|
|
|
|
|
|
public class ApipaySubmit {
|
|
|
+
|
|
|
+ private static Logger logger = Logger.getLogger(ApipaySubmit.class);
|
|
|
+
|
|
|
/**
|
|
|
* api请求的签名工具方法,把请求参数按照字符排序拼接,然后进行RAS加密
|
|
|
*
|
|
|
@@ -25,6 +29,7 @@ public class ApipaySubmit {
|
|
|
pfxCertFileInputStream = new FileSystemResource(DirectPayConfig.PATH_PARTER_PKCS12).getInputStream();
|
|
|
signResult = SignUtils.rsaSign(sPara, sParaTemp.get("charset"), pfxCertFileInputStream);
|
|
|
} catch (Exception e) {
|
|
|
+ logger.error(e.getMessage());
|
|
|
throw new RuntimeException("签名失败,请检查证书文件是否存在,密码是否正确");
|
|
|
}
|
|
|
|
|
|
@@ -50,6 +55,7 @@ public class ApipaySubmit {
|
|
|
.getInputStream();
|
|
|
isSign = SignUtils.rsaCheckContent(publicCertFileInputStream, responseBody, sign, charset);
|
|
|
} catch (Exception e) {
|
|
|
+ logger.error(e.getMessage());
|
|
|
throw new RuntimeException("验证签名失败,请检查银盛公钥证书文件是否存在");
|
|
|
}
|
|
|
|
|
|
@@ -71,6 +77,7 @@ public class ApipaySubmit {
|
|
|
String mysign = SignUtils.rsaSign(sPara, sParaTemp.get("charset"), pfxCertFileInputStream);
|
|
|
sPara.put("sign", mysign);
|
|
|
} catch (Exception e) {
|
|
|
+ logger.error(e.getMessage());
|
|
|
throw new RuntimeException("签名失败,请检查证书文件是否存在,密码是否正确");
|
|
|
}
|
|
|
|
|
|
@@ -97,6 +104,7 @@ public class ApipaySubmit {
|
|
|
}
|
|
|
isSign = SignUtils.rsaCheckContent(publicCertFileInputStream, params, sign, DirectPayConfig.DEFAULT_CHARSET);
|
|
|
} catch (Exception e) {
|
|
|
+ logger.error(e.getMessage());
|
|
|
throw new RuntimeException("验证签名失败,请检查银盛公钥证书文件是否存在");
|
|
|
}
|
|
|
|