|
@@ -0,0 +1,27 @@
|
|
|
+package com.koobietech.eas.common.utils;
|
|
|
+
|
|
|
+import cn.hutool.crypto.SecureUtil;
|
|
|
+import cn.hutool.crypto.symmetric.AES;
|
|
|
+import com.koobietech.eas.common.exception.EasException;
|
|
|
+
|
|
|
+import java.nio.charset.StandardCharsets;
|
|
|
+
|
|
|
+public class PasswordManager {
|
|
|
+
|
|
|
+ public String decryptPassword(String data, String passwordSignKey) {
|
|
|
+ SecureUtil.disableBouncyCastle();
|
|
|
+ AES aes = new AES(passwordSignKey.getBytes(StandardCharsets.UTF_8));
|
|
|
+ String decryptStr;
|
|
|
+ String decryptPassword;
|
|
|
+ try {
|
|
|
+ decryptStr = aes.decryptStr(data);
|
|
|
+ decryptPassword = decryptStr.substring(13);
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new EasException("AES解密错误", e);
|
|
|
+ }
|
|
|
+ return decryptPassword;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+}
|