diff --git a/PARAMS_RSA_DECRYPT_ENCRYPT.md b/PARAMS_RSA_DECRYPT_ENCRYPT.md
index c4fcdcb..0f6c0a1 100644
--- a/PARAMS_RSA_DECRYPT_ENCRYPT.md
+++ b/PARAMS_RSA_DECRYPT_ENCRYPT.md
@@ -95,7 +95,13 @@ params.setData(RSA.publicEncrypt(datas, RSA.getPublicKey(properties.getPublicKey
### 配置
1. 服务器配置私钥
```
+#配置密钥方式
yexuejc.http.encrypt.private-key=私钥
+#配置证书方式:方式二选一,两者都配置会选择配置密钥方式
+yexuejc.http.encrypt.private-key-path=/lgfishing.keystore
+yexuejc.http.encrypt.private-alias=lgfishing
+yexuejc.http.encrypt.private-pwd=lgfishing2018
+
yexuejc.http.encrypt.encrypt=true //加密:默认false
yexuejc.http.encrypt.decrypt=true //解密:默认false
```
diff --git a/README.md b/README.md
index 4d03cef..f33896b 100644
--- a/README.md
+++ b/README.md
@@ -9,7 +9,7 @@ parent:版本封装
base:功能封装
#### 引用
->yexuejc.springboot.version=1.0.6
+>yexuejc.springboot.version=1.0.7
pom.xml
```
diff --git a/UPDATE.md b/UPDATE.md
index 5a458fa..a611b6a 100644
--- a/UPDATE.md
+++ b/UPDATE.md
@@ -1,7 +1,15 @@
uselaw-base 更新内容
-------------------
-#### version :1.0.6 ~~1.0.5~~
+#### version :1.0.7
+**time:** 2018-5-4 09:54:18
+**branch:** master
+**update:**
+>1. 新增加密证书配置
+>2. RSA迁移到[yexuejc-base:1.1.1](https://github.com/yexuejc/yexuejc-base)工程
+
+#
+##### version :1.0.6 ~~1.0.5~~
**【change:2018-5-15 09:24:37】** 1.0.5 jitpack打包失败,升级版本1.0.6
**time:** 2018-5-4 09:54:18
**branch:** master
diff --git a/pom.xml b/pom.xml
index 66b623a..4a93ba8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
com.yexuejc.springboot
yexuejc-springboot-parent
- 1.0.6
+ 1.0.7
pom
${project.artifactId}
@@ -16,7 +16,7 @@
org.springframework.boot
spring-boot-starter-parent
1.5.12.RELEASE
-
+
@@ -35,7 +35,7 @@
1.2.0
3.4.2
- 1.1.0
+ 1.1.1
0.7.0
1.1.46
1.10
@@ -64,11 +64,11 @@
yexuejc-base
${yexuejc.base.version}
-
-
-
-
-
+
+ com.yexuejc.base
+ yexuejc-base
+ ${yexuejc.base.version}
+
commons-codec
diff --git a/yexuejc-springboot-base/pom.xml b/yexuejc-springboot-base/pom.xml
index 6b7943d..5513aac 100644
--- a/yexuejc-springboot-base/pom.xml
+++ b/yexuejc-springboot-base/pom.xml
@@ -9,7 +9,7 @@
com.yexuejc.springboot
yexuejc-springboot-parent
- 1.0.6
+ 1.0.7
@@ -23,12 +23,12 @@
-
-
+
+
- com.github.yexuejc
- yexuejc-base
+ com.github.yexuejc
+ yexuejc-base
diff --git a/yexuejc-springboot-base/src/main/java/com/yexuejc/springboot/base/filter/ParamsRequestBodyAdvice.java b/yexuejc-springboot-base/src/main/java/com/yexuejc/springboot/base/filter/ParamsRequestBodyAdvice.java
index 659bc24..1c08dc7 100644
--- a/yexuejc-springboot-base/src/main/java/com/yexuejc/springboot/base/filter/ParamsRequestBodyAdvice.java
+++ b/yexuejc-springboot-base/src/main/java/com/yexuejc/springboot/base/filter/ParamsRequestBodyAdvice.java
@@ -1,11 +1,12 @@
package com.yexuejc.springboot.base.filter;
+import com.yexuejc.base.encrypt.RSA;
+import com.yexuejc.base.encrypt.RSA2;
import com.yexuejc.base.pojo.ParamsPO;
import com.yexuejc.base.util.JsonUtil;
import com.yexuejc.base.util.StrUtil;
import com.yexuejc.springboot.base.exception.GatewayException;
import com.yexuejc.springboot.base.util.LogUtil;
-import com.yexuejc.springboot.base.util.RSA;
import org.apache.commons.io.IOUtils;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.core.MethodParameter;
@@ -18,10 +19,7 @@ import org.springframework.web.servlet.mvc.method.annotation.RequestBodyAdvice;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Type;
-import java.security.NoSuchAlgorithmException;
-import java.security.spec.InvalidKeySpecException;
-import java.util.List;
-import java.util.Map;
+import java.security.interfaces.RSAPrivateKey;
/**
* 请求数据解密
@@ -59,10 +57,19 @@ public class ParamsRequestBodyAdvice implements RequestBodyAdvice {
//RSA解密
try {
long t = System.currentTimeMillis();
+ RSAPrivateKey rsaPrivateKey = null;
+ if (StrUtil.isEmpty(properties.getPrivateKey())) {
+ rsaPrivateKey = RSA2.getPrivateKey(
+ this.getClass().getResource(properties.getPrivateKeyPath()).getFile().toString(),
+ properties.getPrivateAlias(),
+ properties.getPrivatePwd());
+ } else {
+ rsaPrivateKey = RSA.getPrivateKey(properties.getPrivateKey());
+ }
String data = new String(
RSA.privateDecrypt(
paramsPO.getData(),
- RSA.getPrivateKey(properties.getPrivateKey())
+ rsaPrivateKey
)
);
//md5 校验
@@ -73,15 +80,9 @@ public class ParamsRequestBodyAdvice implements RequestBodyAdvice {
InputStream body = IOUtils.toInputStream(JsonUtil.obj2Json(StrUtil.parseUrlencoded(data)), "UTF-8");
LogUtil.accessLogger.info("解密耗时:{}", System.currentTimeMillis() - t);
return new MyHttpInputMessage(inputMessage.getHeaders(), body);
- } catch (NoSuchAlgorithmException e) {
- e.printStackTrace();
- throw new GatewayException("data错误");
- } catch (InvalidKeySpecException e) {
- e.printStackTrace();
- throw new GatewayException("data错误");
} catch (Exception e) {
e.printStackTrace();
- throw new GatewayException("data错误");
+ LogUtil.accessLogger.error("解密失败,直接传递参数{}。\n异常信息:{}", JsonUtil.obj2Json(paramsPO), e);
}
}
return inputMessage;
diff --git a/yexuejc-springboot-base/src/main/java/com/yexuejc/springboot/base/filter/ParamsResponseBodyAdvice.java b/yexuejc-springboot-base/src/main/java/com/yexuejc/springboot/base/filter/ParamsResponseBodyAdvice.java
index cca6bb6..4746031 100644
--- a/yexuejc-springboot-base/src/main/java/com/yexuejc/springboot/base/filter/ParamsResponseBodyAdvice.java
+++ b/yexuejc-springboot-base/src/main/java/com/yexuejc/springboot/base/filter/ParamsResponseBodyAdvice.java
@@ -1,10 +1,11 @@
package com.yexuejc.springboot.base.filter;
+import com.yexuejc.base.encrypt.RSA;
+import com.yexuejc.base.encrypt.RSA2;
import com.yexuejc.base.http.Resps;
import com.yexuejc.base.util.JsonUtil;
import com.yexuejc.base.util.StrUtil;
import com.yexuejc.springboot.base.util.LogUtil;
-import com.yexuejc.springboot.base.util.RSA;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.core.MethodParameter;
import org.springframework.http.MediaType;
@@ -13,8 +14,7 @@ import org.springframework.http.server.ServerHttpResponse;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice;
-import java.security.NoSuchAlgorithmException;
-import java.security.spec.InvalidKeySpecException;
+import java.security.interfaces.RSAPrivateKey;
import java.util.List;
import java.util.Map;
@@ -69,13 +69,19 @@ public class ParamsResponseBodyAdvice implements ResponseBodyAdvice {
}
resps.setSign(StrUtil.toMD5(data));
try {
+ RSAPrivateKey rsaPrivateKey = null;
+ if (StrUtil.isEmpty(properties.getPrivateKey())) {
+ rsaPrivateKey = RSA2.getPrivateKey(
+ this.getClass().getResource(properties.getPrivateKeyPath()).getFile().toString(),
+ properties.getPrivateAlias(),
+ properties.getPrivatePwd());
+ } else {
+ rsaPrivateKey = RSA.getPrivateKey(properties.getPrivateKey());
+ }
resps.setData(
- RSA.privateEncrypt(JsonUtil.obj2Json(resps.getData()), RSA.getPrivateKey(properties.getPrivateKey()))
+ RSA.privateEncrypt(JsonUtil.obj2Json(resps.getData()), rsaPrivateKey)
);
- } catch (NoSuchAlgorithmException e) {
- e.printStackTrace();
- LogUtil.accessLogger.error("出参加密错误,进行明文出参{}。\n异常信息:{}", JsonUtil.obj2Json(resps), e.getMessage());
- } catch (InvalidKeySpecException e) {
+ } catch (Exception e) {
e.printStackTrace();
LogUtil.accessLogger.error("出参加密错误,进行明文出参{}。\n异常信息:{}", JsonUtil.obj2Json(resps), e.getMessage());
}
diff --git a/yexuejc-springboot-base/src/main/java/com/yexuejc/springboot/base/filter/RsaProperties.java b/yexuejc-springboot-base/src/main/java/com/yexuejc/springboot/base/filter/RsaProperties.java
index 6a819c6..5bfa663 100644
--- a/yexuejc-springboot-base/src/main/java/com/yexuejc/springboot/base/filter/RsaProperties.java
+++ b/yexuejc-springboot-base/src/main/java/com/yexuejc/springboot/base/filter/RsaProperties.java
@@ -16,10 +16,27 @@ public class RsaProperties {
* 私钥
*/
private String privateKey = "";
+ /**
+ * 私钥证书路径:默认private.keystore
+ */
+ private String privateKeyPath = "/private.keystore";
+ /**
+ * 私钥证书别名
+ */
+ private String privateAlias = "alias";
+ /**
+ * 私钥证书密码
+ */
+ private String privatePwd = "password";
/**
* 公钥
*/
private String publicKey = "";
+ /**
+ * 公钥证书路径:默认public.cer
+ */
+ private String publicKeyPath = "/public.cer";
+
/**
* 是否解密
*/
@@ -42,6 +59,38 @@ public class RsaProperties {
this.decrypt = decrypt;
}
+ public String getPrivateKeyPath() {
+ return privateKeyPath;
+ }
+
+ public void setPrivateKeyPath(String privateKeyPath) {
+ this.privateKeyPath = privateKeyPath;
+ }
+
+ public String getPrivateAlias() {
+ return privateAlias;
+ }
+
+ public void setPrivateAlias(String privateAlias) {
+ this.privateAlias = privateAlias;
+ }
+
+ public String getPrivatePwd() {
+ return privatePwd;
+ }
+
+ public void setPrivatePwd(String privatePwd) {
+ this.privatePwd = privatePwd;
+ }
+
+ public String getPublicKeyPath() {
+ return publicKeyPath;
+ }
+
+ public void setPublicKeyPath(String publicKeyPath) {
+ this.publicKeyPath = publicKeyPath;
+ }
+
public boolean isEncrypt() {
return encrypt;
}
diff --git a/yexuejc-springboot-base/src/main/java/com/yexuejc/springboot/base/util/RSA.java b/yexuejc-springboot-base/src/main/java/com/yexuejc/springboot/base/util/RSA.java
deleted file mode 100644
index b4310d6..0000000
--- a/yexuejc-springboot-base/src/main/java/com/yexuejc/springboot/base/util/RSA.java
+++ /dev/null
@@ -1,177 +0,0 @@
-package com.yexuejc.springboot.base.util;
-
-import org.apache.commons.codec.binary.Base64;
-import org.apache.tomcat.util.http.fileupload.IOUtils;
-
-import javax.crypto.Cipher;
-import java.io.ByteArrayOutputStream;
-import java.security.*;
-import java.security.interfaces.RSAPrivateKey;
-import java.security.interfaces.RSAPublicKey;
-import java.security.spec.InvalidKeySpecException;
-import java.security.spec.PKCS8EncodedKeySpec;
-import java.security.spec.X509EncodedKeySpec;
-import java.util.HashMap;
-import java.util.Map;
-
-public class RSA {
-
- public static final String CHARSET = "UTF-8";
- public static final String RSA_ALGORITHM = "RSA";
-
- public static Map initKeys(int keySize) {
- //为RSA算法创建一个KeyPairGenerator对象
- KeyPairGenerator kpg;
- try {
- kpg = KeyPairGenerator.getInstance(RSA_ALGORITHM);
- } catch (NoSuchAlgorithmException e) {
- throw new IllegalArgumentException("No such algorithm-->[" + RSA_ALGORITHM + "]");
- }
-
- //初始化KeyPairGenerator对象,密钥长度
- kpg.initialize(keySize);
- //生成密匙对
- KeyPair keyPair = kpg.generateKeyPair();
- //得到公钥
- Key publicKey = keyPair.getPublic();
- String publicKeyStr = Base64.encodeBase64URLSafeString(publicKey.getEncoded());
- //得到私钥
- Key privateKey = keyPair.getPrivate();
- String privateKeyStr = Base64.encodeBase64URLSafeString(privateKey.getEncoded());
- Map keyPairMap = new HashMap();
- keyPairMap.put("publicKey", publicKeyStr);
- keyPairMap.put("privateKey", privateKeyStr);
-
- return keyPairMap;
- }
-
- /**
- * 得到公钥
- *
- * @param publicKey 密钥字符串(经过base64编码)
- * @throws Exception
- */
- public static RSAPublicKey getPublicKey(String publicKey) throws NoSuchAlgorithmException, InvalidKeySpecException {
- //通过X509编码的Key指令获得公钥对象
- KeyFactory keyFactory = KeyFactory.getInstance(RSA_ALGORITHM);
- X509EncodedKeySpec x509KeySpec = new X509EncodedKeySpec(Base64.decodeBase64(publicKey));
- RSAPublicKey key = (RSAPublicKey) keyFactory.generatePublic(x509KeySpec);
- return key;
- }
-
- /**
- * 得到私钥
- *
- * @param privateKey 密钥字符串(经过base64编码)
- * @throws Exception
- */
- public static RSAPrivateKey getPrivateKey(String privateKey) throws NoSuchAlgorithmException, InvalidKeySpecException {
- //通过PKCS#8编码的Key指令获得私钥对象
- KeyFactory keyFactory = KeyFactory.getInstance(RSA_ALGORITHM);
- PKCS8EncodedKeySpec pkcs8KeySpec = new PKCS8EncodedKeySpec(Base64.decodeBase64(privateKey));
- RSAPrivateKey key = (RSAPrivateKey) keyFactory.generatePrivate(pkcs8KeySpec);
- return key;
- }
-
- /**
- * 公钥加密
- *
- * @param data
- * @param publicKey
- * @return
- */
- public static String publicEncrypt(String data, RSAPublicKey publicKey) {
- try {
- Cipher cipher = Cipher.getInstance(RSA_ALGORITHM);
- cipher.init(Cipher.ENCRYPT_MODE, publicKey);
- return Base64.encodeBase64URLSafeString(rsaSplitCodec(cipher, Cipher.ENCRYPT_MODE, data.getBytes(CHARSET), publicKey.getModulus().bitLength()));
- } catch (Exception e) {
- throw new RuntimeException("加密字符串[" + data + "]时遇到异常", e);
- }
- }
-
- /**
- * 私钥解密
- *
- * @param data
- * @param privateKey
- * @return
- */
-
- public static String privateDecrypt(String data, RSAPrivateKey privateKey) {
- try {
- Cipher cipher = Cipher.getInstance(RSA_ALGORITHM);
- cipher.init(Cipher.DECRYPT_MODE, privateKey);
- return new String(rsaSplitCodec(cipher, Cipher.DECRYPT_MODE, Base64.decodeBase64(data), privateKey.getModulus().bitLength()), CHARSET);
- } catch (Exception e) {
- throw new RuntimeException("解密字符串[" + data + "]时遇到异常", e);
- }
- }
-
- /**
- * 私钥加密
- *
- * @param data
- * @param privateKey
- * @return
- */
-
- public static String privateEncrypt(String data, RSAPrivateKey privateKey) {
- try {
- Cipher cipher = Cipher.getInstance(RSA_ALGORITHM);
- cipher.init(Cipher.ENCRYPT_MODE, privateKey);
- return Base64.encodeBase64URLSafeString(rsaSplitCodec(cipher, Cipher.ENCRYPT_MODE, data.getBytes(CHARSET), privateKey.getModulus().bitLength()));
- } catch (Exception e) {
- throw new RuntimeException("加密字符串[" + data + "]时遇到异常", e);
- }
- }
-
- /**
- * 公钥解密
- *
- * @param data
- * @param publicKey
- * @return
- */
-
- public static String publicDecrypt(String data, RSAPublicKey publicKey) {
- try {
- Cipher cipher = Cipher.getInstance(RSA_ALGORITHM);
- cipher.init(Cipher.DECRYPT_MODE, publicKey);
- return new String(rsaSplitCodec(cipher, Cipher.DECRYPT_MODE, Base64.decodeBase64(data), publicKey.getModulus().bitLength()), CHARSET);
- } catch (Exception e) {
- throw new RuntimeException("解密字符串[" + data + "]时遇到异常", e);
- }
- }
-
- private static byte[] rsaSplitCodec(Cipher cipher, int opmode, byte[] datas, int keySize) {
- int maxBlock = 0;
- if (opmode == Cipher.DECRYPT_MODE) {
- maxBlock = keySize / 8;
- } else {
- maxBlock = keySize / 8 - 11;
- }
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- int offSet = 0;
- byte[] buff;
- int i = 0;
- try {
- while (datas.length > offSet) {
- if (datas.length - offSet > maxBlock) {
- buff = cipher.doFinal(datas, offSet, maxBlock);
- } else {
- buff = cipher.doFinal(datas, offSet, datas.length - offSet);
- }
- out.write(buff, 0, buff.length);
- i++;
- offSet = i * maxBlock;
- }
- } catch (Exception e) {
- throw new RuntimeException("加解密阀值为[" + maxBlock + "]的数据时发生异常", e);
- }
- byte[] resultDatas = out.toByteArray();
- IOUtils.closeQuietly(out);
- return resultDatas;
- }
-
-}
diff --git a/yexuejc-springboot-base/src/test/java/com/yexuejc/springboot/base/ApplicationTest.java b/yexuejc-springboot-base/src/test/java/com/yexuejc/springboot/base/ApplicationTest.java
index 551c371..9933978 100644
--- a/yexuejc-springboot-base/src/test/java/com/yexuejc/springboot/base/ApplicationTest.java
+++ b/yexuejc-springboot-base/src/test/java/com/yexuejc/springboot/base/ApplicationTest.java
@@ -1,17 +1,22 @@
package com.yexuejc.springboot.base;
+import com.yexuejc.base.encrypt.RSA;
+import com.yexuejc.base.encrypt.RSA2;
import com.yexuejc.base.pojo.ParamsPO;
import com.yexuejc.base.util.JsonUtil;
import com.yexuejc.base.util.StrUtil;
import com.yexuejc.springboot.base.filter.RsaProperties;
-import com.yexuejc.springboot.base.util.RSA;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import java.io.IOException;
+import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
+import java.security.UnrecoverableKeyException;
+import java.security.cert.CertificateException;
import java.security.spec.InvalidKeySpecException;
import java.util.HashMap;
import java.util.List;
@@ -25,6 +30,12 @@ public class ApplicationTest {
@Autowired
RsaProperties properties;
+ /**
+ * 客户端加密
+ *
+ * @throws InvalidKeySpecException
+ * @throws NoSuchAlgorithmException
+ */
@Test
public void contextLoads() throws InvalidKeySpecException, NoSuchAlgorithmException {
Map map = new HashMap();
@@ -50,6 +61,12 @@ public class ApplicationTest {
// "sign":"d46b089cdea6ddbe3a747a27454ae090"}
}
+ /**
+ * 客户端解密
+ *
+ * @throws InvalidKeySpecException
+ * @throws NoSuchAlgorithmException
+ */
@Test
public void t2() throws InvalidKeySpecException, NoSuchAlgorithmException {
// String strData = "KrlXChF8LE94EEnycvbi8AygpaZiHKaXH_OmC5sGhGQlvYp1arNk6WW7yR7kAWMLugCS5TKf8FIiYXnyuI8vjA";
@@ -77,7 +94,7 @@ public class ApplicationTest {
// ).isEqualTo("fc4ead323d52f2b1122d1a9634c865c6");
// ).isEqualTo("c4ca4238a0b923820dcc509a6f75849b");
// ).isEqualTo("b326b5062b2f0e69046810717534cb09");
- ).isEqualTo("c977050805d8d1ebaa1e03525cbaee15");
+ ).isEqualTo("c977050805d8d1ebaa1e03525cbaee15");
//map
assertThat(
@@ -101,4 +118,42 @@ public class ApplicationTest {
}
+
+ /**
+ * 证书操作
+ *
+ * @throws CertificateException
+ * @throws IOException
+ * @throws UnrecoverableKeyException
+ * @throws NoSuchAlgorithmException
+ * @throws KeyStoreException
+ */
+ @Test
+ public void file() throws CertificateException, IOException, UnrecoverableKeyException, NoSuchAlgorithmException, KeyStoreException {
+ String publicKey = this.getClass().getResource("/lgfishing.cer").getFile().toString();
+ String privateKey = this.getClass().getResource("/lgfishing.keystore").getFile().toString();
+
+ String privatePwd = "lgfishing2018";
+ String privateAlias = "lgfishing";
+
+ String dataStr = "{\"ret\":\"0\",\"ExpireTime\":\"2015/10/28 23:59:59\",\"rettxt\":\"OK\",\"Token\":\"69296128A59798E2D423D3B1A9F766F4\"}'";
+
+/***************************************************************************************************************************************************************************************************************************************/
+ //客户端公钥加密
+ String publicEncryptResult = RSA.publicEncrypt(dataStr, RSA2.getPublicKey(publicKey));
+ System.out.println(publicEncryptResult);
+
+ //服务器私钥解密
+ String privateDecryptResult = RSA.privateDecrypt(publicEncryptResult, RSA2.getPrivateKey(privateKey, privateAlias, privatePwd));
+ System.out.println(privateDecryptResult);
+/***************************************************************************************************************************************************************************************************************************************/
+ //服务器端私钥加密
+ String privateEncryptResult = RSA.privateEncrypt(dataStr, RSA2.getPrivateKey(privateKey, privateAlias, privatePwd));
+ System.out.println(privateEncryptResult);
+
+ //客户端公钥解密
+ String publicDecryptResult = RSA.publicDecrypt(privateEncryptResult, RSA2.getPublicKey(publicKey));
+ System.out.println(publicDecryptResult);
+
+ }
}
diff --git a/yexuejc-springboot-base/src/test/resources/application.properties b/yexuejc-springboot-base/src/test/resources/application.properties
index 3caa578..499140d 100644
--- a/yexuejc-springboot-base/src/test/resources/application.properties
+++ b/yexuejc-springboot-base/src/test/resources/application.properties
@@ -5,10 +5,16 @@ security.basic.enabled=false
yexuejc.http.filter.type=0
-yexuejc.http.encrypt.private-key=MIIBVAIBADANBgkqhkiG9w0BAQEFAASCAT4wggE6AgEAAkEAiSo5blJ9-QJ0_QElcy5AaRTq-3oO4lJ8PvIOIt-Xr5SUFODVj3DUbiy6_0bxQYO3NiYHlXPb37UVV3jjlXJsXwIDAQABAkBE0WOJH2hGs93gRl_0vwLf9ffDfkTTdlER_73p70aad3QZRslEkinQH7G5aE_DgBm5m72TCeH-PD2FZ2lwtavBAiEAvnRown5Lpqbl0tN_OUxr_e1u9d_-8dNL_JEETO7BZCECIQC4XtY-18j0bVVLxaXPjKQ00D59yntwObihDNyRK0nAfwIgHPHEGgrnpGQo-Wl7JFIg925mNqfcLxRVsAS6CpcefQECIQCUsLdsmy6QIhTmNRJSXoSXq1KatE_05DhIekzwLs8eFQIgfMawMiu52ZxBI5_pZ7ancQZ6Dsxl45utFqJShzV1pio
-yexuejc.http.encrypt.public-key=MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAIkqOW5SffkCdP0BJXMuQGkU6vt6DuJSfD7yDiLfl6-UlBTg1Y9w1G4suv9G8UGDtzYmB5Vz29-1FVd445VybF8CAwEAAQ
+
yexuejc.http.encrypt.encrypt=true
yexuejc.http.encrypt.decrypt=true
+#配置密钥方式
+#yexuejc.http.encrypt.private-key=MIIBVAIBADANBgkqhkiG9w0BAQEFAASCAT4wggE6AgEAAkEAiSo5blJ9-QJ0_QElcy5AaRTq-3oO4lJ8PvIOIt-Xr5SUFODVj3DUbiy6_0bxQYO3NiYHlXPb37UVV3jjlXJsXwIDAQABAkBE0WOJH2hGs93gRl_0vwLf9ffDfkTTdlER_73p70aad3QZRslEkinQH7G5aE_DgBm5m72TCeH-PD2FZ2lwtavBAiEAvnRown5Lpqbl0tN_OUxr_e1u9d_-8dNL_JEETO7BZCECIQC4XtY-18j0bVVLxaXPjKQ00D59yntwObihDNyRK0nAfwIgHPHEGgrnpGQo-Wl7JFIg925mNqfcLxRVsAS6CpcefQECIQCUsLdsmy6QIhTmNRJSXoSXq1KatE_05DhIekzwLs8eFQIgfMawMiu52ZxBI5_pZ7ancQZ6Dsxl45utFqJShzV1pio
+#yexuejc.http.encrypt.public-key=MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAIkqOW5SffkCdP0BJXMuQGkU6vt6DuJSfD7yDiLfl6-UlBTg1Y9w1G4suv9G8UGDtzYmB5Vz29-1FVd445VybF8CAwEAAQ
+#配置证书方式
+yexuejc.http.encrypt.private-key-path=/lgfishing.keystore
+yexuejc.http.encrypt.private-alias=lgfishing
+yexuejc.http.encrypt.private-pwd=lgfishing2018
#编码
diff --git a/yexuejc-springboot-base/src/test/resources/lgfishing.cer b/yexuejc-springboot-base/src/test/resources/lgfishing.cer
new file mode 100644
index 0000000..a602ddf
Binary files /dev/null and b/yexuejc-springboot-base/src/test/resources/lgfishing.cer differ
diff --git a/yexuejc-springboot-base/src/test/resources/lgfishing.keystore b/yexuejc-springboot-base/src/test/resources/lgfishing.keystore
new file mode 100644
index 0000000..ff8a785
Binary files /dev/null and b/yexuejc-springboot-base/src/test/resources/lgfishing.keystore differ