Commit 9e0819c0a9dda6fe92af4621964445d7346344f7
1 parent
8ef2d228
JeecgBoot 2.0.2 版本发布
Showing
1 changed file
with
2 additions
and
3 deletions
jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/encryption/AesEncryptUtil.java
@@ -13,7 +13,6 @@ public class AesEncryptUtil { | @@ -13,7 +13,6 @@ public class AesEncryptUtil { | ||
13 | 13 | ||
14 | //使用AES-128-CBC加密模式,key需要为16位,key和iv可以相同! | 14 | //使用AES-128-CBC加密模式,key需要为16位,key和iv可以相同! |
15 | private static String KEY = EncryptedString.key; | 15 | private static String KEY = EncryptedString.key; |
16 | - | ||
17 | private static String IV = EncryptedString.iv; | 16 | private static String IV = EncryptedString.iv; |
18 | 17 | ||
19 | /** | 18 | /** |
@@ -45,7 +44,7 @@ public class AesEncryptUtil { | @@ -45,7 +44,7 @@ public class AesEncryptUtil { | ||
45 | cipher.init(Cipher.ENCRYPT_MODE, keyspec, ivspec); | 44 | cipher.init(Cipher.ENCRYPT_MODE, keyspec, ivspec); |
46 | byte[] encrypted = cipher.doFinal(plaintext); | 45 | byte[] encrypted = cipher.doFinal(plaintext); |
47 | 46 | ||
48 | - return new Base64().encodeToString(encrypted); | 47 | + return Base64.encodeToString(encrypted); |
49 | 48 | ||
50 | } catch (Exception e) { | 49 | } catch (Exception e) { |
51 | e.printStackTrace(); | 50 | e.printStackTrace(); |
@@ -63,7 +62,7 @@ public class AesEncryptUtil { | @@ -63,7 +62,7 @@ public class AesEncryptUtil { | ||
63 | */ | 62 | */ |
64 | public static String desEncrypt(String data, String key, String iv) throws Exception { | 63 | public static String desEncrypt(String data, String key, String iv) throws Exception { |
65 | try { | 64 | try { |
66 | - byte[] encrypted1 = new Base64().decode(data); | 65 | + byte[] encrypted1 = Base64.decode(data); |
67 | 66 | ||
68 | Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding"); | 67 | Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding"); |
69 | SecretKeySpec keyspec = new SecretKeySpec(key.getBytes(), "AES"); | 68 | SecretKeySpec keyspec = new SecretKeySpec(key.getBytes(), "AES"); |