java110
2023-05-30 3d8ec5c23ef49d0908195c8b5b892920a46aaa8c
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");