From f6b935781bcb43faea7aa894ce3a55873769efb3 Mon Sep 17 00:00:00 2001
From: whycxzp <perryhsu@163.com>
Date: 星期三, 22 十二月 2021 15:20:47 +0800
Subject: [PATCH] 1.内置密码解码,多重密码混淆 2.外部运行虚假密码(未生效密码混淆)

---
 beale-core/src/main/java/com/whyc/JarEncryptor.java |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/beale-core/src/main/java/com/whyc/JarEncryptor.java b/beale-core/src/main/java/com/whyc/JarEncryptor.java
index b30fff1..ac10a84 100644
--- a/beale-core/src/main/java/com/whyc/JarEncryptor.java
+++ b/beale-core/src/main/java/com/whyc/JarEncryptor.java
@@ -192,16 +192,28 @@
 
         //鍔犲瘑鍚庡瓨鍌ㄧ殑浣嶇疆
         File metaDir = new File(this.targetDir, "META-INF" + File.separator + Const.FILE_NAME);
+        File descriptionDir = new File(this.targetDir, "META-INF" + File.separator);
         if (!metaDir.exists()) {
             metaDir.mkdirs();
         }
 
         //鏃犲瘑鐮佹ā寮�,鑷姩鐢熸垚涓�涓瘑鐮�
-        if (this.password.length == 1 && this.password[0] == '#') {
+        /*if (this.password.length == 1 && this.password[0] == '#') {
             char[] randChars = EncryptUtils.randChar(32);
             this.password = EncryptUtils.md5(randChars);
             File configPass = new File(metaDir, Const.CONFIG_PASS);
             IoUtils.writeFile(configPass, StrUtils.toBytes(randChars));
+        }*/
+
+        //瀵嗙爜鏂囦欢鐢熸垚
+        if (this.password.length == 1 && this.password[0] == '#') {
+            char[] randChars2 = Const.FILE_NAME2_DESCRIPTION.replace(" ", "").toCharArray();
+            //瀵嗙爜涓烘贩娣� 鍘熺爜+鐩�
+            this.password = StrUtils.merger(randChars2, EncryptUtils.SALT);
+            String password2 = EncryptUtils.enAES(Arrays.toString(password), Const.AES_KEY.toCharArray());
+            File configPass = new File(descriptionDir, Const.FILE_NAME2);
+            //灏嗘贩娣嗗悗鐨勫瘑鐮佸姞瀵嗗悗瀛樺偍
+            IoUtils.writeFile(configPass, password2.getBytes());
         }
 
         //鏈夋満鍣ㄧ爜

--
Gitblit v1.9.1