|
|
@@ -1,11 +1,11 @@
|
|
|
/**
|
|
|
*
|
|
|
* Licensed Property to Sand Co., Ltd.
|
|
|
- *
|
|
|
+ *
|
|
|
* (C) Copyright of Sand Co., Ltd. 2010
|
|
|
* All Rights Reserved.
|
|
|
*
|
|
|
- *
|
|
|
+ *
|
|
|
* Modification History:
|
|
|
* =============================================================================
|
|
|
* Author Date Description
|
|
|
@@ -15,10 +15,6 @@
|
|
|
*/
|
|
|
package cn.com.sandpay.cashier.sdk;
|
|
|
//支付宝生活号/支付宝小程序
|
|
|
-
|
|
|
-import org.slf4j.Logger;
|
|
|
-import org.slf4j.LoggerFactory;
|
|
|
-
|
|
|
import java.io.FileInputStream;
|
|
|
import java.io.FileNotFoundException;
|
|
|
import java.io.IOException;
|
|
|
@@ -32,6 +28,9 @@ import java.security.cert.X509Certificate;
|
|
|
import java.util.Enumeration;
|
|
|
import java.util.concurrent.ConcurrentHashMap;
|
|
|
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* @ClassName: CertUtil
|
|
|
@@ -39,7 +38,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
|
|
* @version 2.0.0
|
|
|
*/
|
|
|
public class CertUtil {
|
|
|
-
|
|
|
+
|
|
|
public static final String PUBLIC_KEY = "public_key";
|
|
|
public static final String PRIVATE_KEY = "private_key";
|
|
|
|
|
|
@@ -92,7 +91,7 @@ public class CertUtil {
|
|
|
InputStream inputStream = null;
|
|
|
if (privateKeyPath.startsWith(classpathKey)) {
|
|
|
inputStream = CertUtil.class.getClassLoader()
|
|
|
- .getResourceAsStream("cert/0424.pfx");
|
|
|
+ .getResourceAsStream(privateKeyPath.substring(classpathKey.length()));
|
|
|
} else {
|
|
|
inputStream = new FileInputStream(privateKeyPath);
|
|
|
}
|
|
|
@@ -105,7 +104,7 @@ public class CertUtil {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+
|
|
|
public static PublicKey getPublicKey(InputStream inputStream) throws Exception {
|
|
|
try {
|
|
|
|
|
|
@@ -126,10 +125,10 @@ public class CertUtil {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 获取私钥对象
|
|
|
- *
|
|
|
+ *
|
|
|
* @param inputStream
|
|
|
* 私钥输入流
|
|
|
* @param keyAlgorithm
|