|
@@ -12,7 +12,6 @@ import javax.crypto.spec.IvParameterSpec;
|
|
import javax.crypto.spec.SecretKeySpec;
|
|
import javax.crypto.spec.SecretKeySpec;
|
|
|
|
|
|
public class MD5Util {
|
|
public class MD5Util {
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* 获取十六进制字符串形式的MD5摘要
|
|
* 获取十六进制字符串形式的MD5摘要
|
|
*/
|
|
*/
|
|
@@ -44,12 +43,12 @@ public class MD5Util {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- public static String decryptAES(String encrypted, String key) throws Exception {
|
|
|
|
|
|
+ public static String decryptAES(String encrypted) throws Exception {
|
|
final byte[] encryptedBytes = android.util.Base64.decode(encrypted, android.util.Base64.DEFAULT);
|
|
final byte[] encryptedBytes = android.util.Base64.decode(encrypted, android.util.Base64.DEFAULT);
|
|
final byte[] iv = Arrays.copyOfRange(encryptedBytes, 0, 16);
|
|
final byte[] iv = Arrays.copyOfRange(encryptedBytes, 0, 16);
|
|
final byte[] encryptedData = Arrays.copyOfRange(encryptedBytes, 16, encryptedBytes.length);
|
|
final byte[] encryptedData = Arrays.copyOfRange(encryptedBytes, 16, encryptedBytes.length);
|
|
|
|
|
|
- SecretKeySpec skeySpec = new SecretKeySpec(key.getBytes(StandardCharsets.UTF_8), "AES");
|
|
|
|
|
|
+ SecretKeySpec skeySpec = new SecretKeySpec(decodeBase64(SwagoInfo.INSTANCE.getKey()).getBytes(StandardCharsets.UTF_8), "AES");
|
|
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
|
|
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
|
|
IvParameterSpec ivParameterSpec = new IvParameterSpec(iv);
|
|
IvParameterSpec ivParameterSpec = new IvParameterSpec(iv);
|
|
cipher.init(Cipher.DECRYPT_MODE, skeySpec, ivParameterSpec);
|
|
cipher.init(Cipher.DECRYPT_MODE, skeySpec, ivParameterSpec);
|