From fe3b0f4a3c46892f08421dd4c4d0937fb8a87f93 Mon Sep 17 00:00:00 2001
From: Your Name <you@example.com>
Date: 星期二, 06 六月 2023 17:55:10 +0800
Subject: [PATCH] 优化代码
---
java110-core/src/main/java/com/java110/core/factory/AuthenticationFactory.java | 20 +++++++++++---------
1 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/java110-core/src/main/java/com/java110/core/factory/AuthenticationFactory.java b/java110-core/src/main/java/com/java110/core/factory/AuthenticationFactory.java
index 70cad92..cd2b901 100755
--- a/java110-core/src/main/java/com/java110/core/factory/AuthenticationFactory.java
+++ b/java110-core/src/main/java/com/java110/core/factory/AuthenticationFactory.java
@@ -45,7 +45,9 @@
*/
public class AuthenticationFactory {
- private final static String PASSWD_SALT = "hc@java110";
+ public final static String PASSWD_SALT = "hc@java110";
+
+ public final static String AES_KEY = "whoisyourdaddy!!";
/**
* 鍋忕Щ鍙橀噺锛屽浐瀹氬崰8浣嶅瓧鑺�
*/
@@ -72,10 +74,10 @@
return null;
}
// 鍒ゆ柇Key鏄惁涓�16浣�
- if (sKey.length() != 16) {
- System.out.print("Key闀垮害涓嶆槸16浣�");
- return null;
- }
+// if (sKey.length() != 16) {
+// System.out.print("Key闀垮害涓嶆槸16浣�");
+// return null;
+// }
byte[] raw = sKey.getBytes("utf-8");
SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES");
Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");//"绠楁硶/妯″紡/琛ョ爜鏂瑰紡"
@@ -98,10 +100,10 @@
return null;
}
// 鍒ゆ柇Key鏄惁涓�16浣�
- if (sKey.length() != 16) {
- System.out.print("Key闀垮害涓嶆槸16浣�");
- return null;
- }
+// if (sKey.length() != 16) {
+// System.out.print("Key闀垮害涓嶆槸16浣�");
+// return null;
+// }
byte[] raw = sKey.getBytes("utf-8");
SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES");
Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
--
Gitblit v1.8.0