From d10903676d7e2de7ad3eae6c4370da6dfd946fc2 Mon Sep 17 00:00:00 2001 From: "zhanglei@ap-leasing.com.cn" Date: Tue, 26 Sep 2023 11:27:36 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A3=8E=E6=8E=A7=E4=B8=AD=E5=8F=B0-=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E7=94=9F=E4=BA=A7=E5=92=8C=E6=B5=8B=E8=AF=95=E7=8E=AF?= =?UTF-8?q?=E5=A2=83=E5=8F=82=E6=95=B0=E5=BC=80=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/baic.properties | 18 +++++++++++++----- config/rsa_public_key.pem | 10 ++++++++++ .../ample/esb/controller/AfsUrlController.java | 4 ++-- src/com/ample/esb/util/BaicPropertiesUtil.java | 5 ++++- 4 files changed, 29 insertions(+), 8 deletions(-) create mode 100644 config/rsa_public_key.pem diff --git a/config/baic.properties b/config/baic.properties index 61c778c81..00c370716 100644 --- a/config/baic.properties +++ b/config/baic.properties @@ -3,11 +3,19 @@ esb_url=http://47.93.34.101/baicfc/trans? userid=TYJWBY7F AFS012_serviceid=N9LZG7J8OXSD90B4 AMP005_serviceid=24LITXVE9LKXANTD - log_path=/data/esb/log/ -## 反欺诈 -afs_url=http://test-antifraud.baicfc.com/Instinct.UI.WebClient_5.3.1_2023/api/redirect? -RSAPublicKey=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtmxe7GIws+1RwPtICBi+GKbNEYrqz+xkPZN8Cv3vnyK/cX87n2volMPV1LZBGLyFj2ckyLmIt+uC1SHDio+N9/e695UT2rvTJdP7rho0yA2sXmAqG4pjVA8dPHFgvUIaW/SIwPpqHnPrKTj6YHp5/6Amuvq7W5WujHsM1aq61p0RL6b6CQlwQtXK1MGE95eDJrhY0eO2RcoKBOJgQSa2MdqSSQ9jYuu/9lpoENxvHcHydxFqwzwJtP4Noct9ZplSjxA/OsincK4q6ELSDL3f9ckBXGmZrHDkYVyv0hD1QeC8Pgy3FAppgPPfMXPLUWgswV24/dEJP8qiCTacFfF9iwIDAQAB +## afs config +afs_url=http://afsapf.rms.baicfc.com/Instinct.UI.WebClient_5.3.1/api/redirect? +RSAPublicKey=/soft/apache-tomcat-7.0.90/webapps/apzl_leasing/WEB-INF/classes/rsa_public_key.pem -rc_score_result_url=http://10.91.122.11:8081/baicaplcredit/businessFlow/rzzlCreditResultForThirdParty.jsp \ No newline at end of file +is_prd=false + +#test# +esb_url_test=http://47.93.34.101/baicfc/trans? +userid_test=TYJWBY7F +AFS012_serviceid_test=N9LZG7J8OXSD90B4 +AMP005_serviceid_test=24LITXVE9LKXANTD +log_path_test=/data/esb/log/ +afs_url_test=http://test-antifraud.baicfc.com/Instinct.UI.WebClient_5.3.1_2023/api/redirect? +RSAPublicKey_test=/soft/apache-tomcat-7.0.90/webapps/apzl_leasing/WEB-INF/classes/rsa_public_key.pem diff --git a/config/rsa_public_key.pem b/config/rsa_public_key.pem new file mode 100644 index 000000000..4241e857c --- /dev/null +++ b/config/rsa_public_key.pem @@ -0,0 +1,10 @@ +-----BEGIN PUBLIC KEY----- +MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtmxe7GIws+1RwPtICBi+ +GKbNEYrqz+xkPZN8Cv3vnyK/cX87n2volMPV1LZBGLyFj2ckyLmIt+uC1SHDio+N +9/e695UT2rvTJdP7rho0yA2sXmAqG4pjVA8dPHFgvUIaW/SIwPpqHnPrKTj6YHp5 +/6Amuvq7W5WujHsM1aq61p0RL6b6CQlwQtXK1MGE95eDJrhY0eO2RcoKBOJgQSa2 +MdqSSQ9jYuu/9lpoENxvHcHydxFqwzwJtP4Noct9ZplSjxA/OsincK4q6ELSDL3f +9ckBXGmZrHDkYVyv0hD1QeC8Pgy3FAppgPPfMXPLUWgswV24/dEJP8qiCTacFfF9 +iwIDAQAB +-----END PUBLIC KEY----- + diff --git a/src/com/ample/esb/controller/AfsUrlController.java b/src/com/ample/esb/controller/AfsUrlController.java index 08139915a..aa187f898 100644 --- a/src/com/ample/esb/controller/AfsUrlController.java +++ b/src/com/ample/esb/controller/AfsUrlController.java @@ -33,8 +33,8 @@ public class AfsUrlController { String rsaString = hashString.substring(hashString.indexOf("redirect?")+"redirect?".length())+"&hash="+hashValue; System.out.println("进行RSA加密的内容:"+rsaString); //todo 密钥文件地址 - //PublicKey publicKey = encryptRsaByFile(""); - PublicKey publicKey = encryptRsaByString(RSAPublicKey); + PublicKey publicKey = encryptRsaByFile(RSAPublicKey); + //PublicKey publicKey = encryptRsaByString(RSAPublicKey); Cipher cipher = Cipher.getInstance("RSA"); cipher.init(Cipher.ENCRYPT_MODE,publicKey); byte[] encryptBytes = cipher.doFinal(rsaString.getBytes(StandardCharsets.UTF_8)); diff --git a/src/com/ample/esb/util/BaicPropertiesUtil.java b/src/com/ample/esb/util/BaicPropertiesUtil.java index 154cc0cd6..9e02486e0 100644 --- a/src/com/ample/esb/util/BaicPropertiesUtil.java +++ b/src/com/ample/esb/util/BaicPropertiesUtil.java @@ -31,6 +31,9 @@ public class BaicPropertiesUtil { public static String get(String propName) { if(attributes == null) load(); - return attributes.get(propName); + if("true".equals(attributes.get("is_prd"))){ + return attributes.get(propName); + } + return attributes.get(propName+"_test"); } }