From 66463d8219b9f795f93e7ab01a3fdaab0971c10f Mon Sep 17 00:00:00 2001 From: luoluogit <1014532975@qq.com> Date: Thu, 19 Dec 2024 17:36:57 +0800 Subject: [PATCH] =?UTF-8?q?update:=E5=8A=A0=E5=AF=86=E8=A7=A3=E5=AF=86?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/shkd/sys/sys/eoss/SSOPluginLogin.java | 2 +- .../sys/sys/midservice/backlogTack/ToDoResendTack.java | 2 +- .../midservice/servicehandler/BacklogServiceHandle.java | 2 +- .../src/main/java/shkd/sys/sys/utils/RSAUtil.java | 8 ++++---- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/eoss/SSOPluginLogin.java b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/eoss/SSOPluginLogin.java index 39e8e64..9e3a4a3 100644 --- a/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/eoss/SSOPluginLogin.java +++ b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/eoss/SSOPluginLogin.java @@ -111,7 +111,7 @@ public class SSOPluginLogin implements ThirdSSOAuthHandler { } }else if (StringUtils.isNotEmpty(userName)){ try{ - String user = RSAUtil.decrypt(userName,RSAUtil.getPrivateKeyFromString()); + String user = RSAUtil.decrypt(userName,RSAUtil.getPrivateKeyFromString(RSAUtil.privateKeyString)); result.setUser(user); result.setSucess(true); logger.info("SSO用户登录成功,进入苍穹系统"); diff --git a/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/midservice/backlogTack/ToDoResendTack.java b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/midservice/backlogTack/ToDoResendTack.java index 85500ee..6f17e07 100644 --- a/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/midservice/backlogTack/ToDoResendTack.java +++ b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/midservice/backlogTack/ToDoResendTack.java @@ -176,7 +176,7 @@ public class ToDoResendTack extends AbstractTask { "phone,username", new QFilter[]{new QFilter("id", "=", next.getString("freceiveuserid"))}); String userName; try { - userName = RSAUtil.decrypt(dynamicObject.getString("username"),RSAUtil.getPrivateKeyFromString()); + userName = RSAUtil.decrypt(dynamicObject.getString("username"),RSAUtil.getPrivateKeyFromString(RSAUtil.publicKeyString)); }catch (Exception e){ ErrorCode errorCode = new ErrorCode("error_code", "公钥加密出现异常,请联系运维人员排查!"); throw new KDException(errorCode, e); diff --git a/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/midservice/servicehandler/BacklogServiceHandle.java b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/midservice/servicehandler/BacklogServiceHandle.java index a8558a1..5bdbc94 100644 --- a/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/midservice/servicehandler/BacklogServiceHandle.java +++ b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/midservice/servicehandler/BacklogServiceHandle.java @@ -46,7 +46,7 @@ public class BacklogServiceHandle extends AbstractServiceHandler { for (DynamicObject query_one : query) { String userName; try { - userName = RSAUtil.encrypt(query_one.getString("username"),RSAUtil.getPublicKeyFromString()); + userName = RSAUtil.encrypt(query_one.getString("username"),RSAUtil.getPublicKeyFromString(RSAUtil.publicKeyString)); }catch (Exception e){ logger.info("####公钥加密出现异常,请联系运维人员排查!"); ErrorCode errorCode = new ErrorCode("error_code", "公钥加密出现异常,请联系运维人员排查!"); diff --git a/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/utils/RSAUtil.java b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/utils/RSAUtil.java index be19f11..38f6dad 100644 --- a/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/utils/RSAUtil.java +++ b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/utils/RSAUtil.java @@ -10,8 +10,8 @@ import java.util.Base64; public class RSAUtil { - private static String publicKeyString = "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fvilCqou/GcF7T5CP//tKqj3RRgCYu3XF1btQ+iXMRc40NzdCdxmH+BMJ9lS51Soi0dzvHuQTn/A/3cviBfmzptqTMp0T2RpXQ0bSe4wqUT3fdenFm39xbw9p+b+eknZ8lrGM6fn06GBP6mQ+USMvZAnkdawKBgQDod5hasx8rMveJsNdqp/vGOFVtCh6RVX0rV8vlJ1tLGAhxBQbPbbmB/H773Fqyhc7NOWPFbSuHXtZtArgTY5wHwHcBZ41nB7E5Y40wMql8eNFhBFAb1M8xy7o+cX5gIsphrBRiGGM9MBhQNea2cH3flKW9NPKdvH3dF0sv/OGDQwKBgQClV60JpDZtdCUcwjPn5+6y+oedmnK6r+Q7MvDTFrMGmhVCJnin2Vzo2RvfDOAO89drBaDtZj/Cw+y4icP831toNdkjsAczVOdHgL3w8pCffpNeg2zkRoC+vIw2pGh3nqija5rB2taa1vGmtVK817W98jj5YvK6+G0jLMppT/oPHQKBgQC7S3Ai02Jvabbq5uIIeqNtxwF8wsRyD9CzVR9f11/Elu5mMMiV4y+tPQQKZDVm1EwUKQLrk9OYU56rYZ9xb7XMwRKgvQ++TQJK3JxqksbfFHCNm+33HnR5CE1b9hD938ny+7PIfSGnsNJF/ceOgf/IXXlTgg9favh1Y0ketr3zBQKBgFKWHvw/i1j4F/6vQIBn4ke22Ja8qXDNLfIUEcgqqvIx5N6Imv8DLyvu56CWveThVzk810VHRqoJ3aIgA8oTs/mQyd8G/S8jbyufl2GeoHap9azSr63HZh4v8ZBMQuA6xP2CEUByEyIWknwo7pp9yj8gJZUFmvTthY6SvkYrqg1H"; /** * 加密 @@ -50,7 +50,7 @@ public class RSAUtil { * @return 公钥 * @throws Exception 异常 */ - public static PublicKey getPublicKeyFromString() throws Exception { + public static PublicKey getPublicKeyFromString(String publicKeyString) throws Exception { byte[] keyBytes = Base64.getDecoder().decode(publicKeyString); X509EncodedKeySpec keySpec = new X509EncodedKeySpec(keyBytes); KeyFactory keyFactory = KeyFactory.getInstance("RSA"); @@ -63,7 +63,7 @@ public class RSAUtil { * @return 私钥 * @throws Exception 异常 */ - public static PrivateKey getPrivateKeyFromString() throws Exception { + public static PrivateKey getPrivateKeyFromString(String privateKeyString) throws Exception { byte[] keyBytes = Base64.getDecoder().decode(privateKeyString); PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(keyBytes); KeyFactory keyFactory = KeyFactory.getInstance("RSA");