|
@@ -42,10 +42,10 @@ class Utils {
|
|
|
return encryptedDataBase64
|
|
|
}
|
|
|
|
|
|
- fun decryptData(ivBase64: String, encryptedBase64: String, secretKeyString: String) : String {
|
|
|
- val iv = Base64.decode(ivBase64, Base64.DEFAULT)
|
|
|
+ fun decryptData(ivKey: String, encryptedBase64: String, secretKeyString: String) : String {
|
|
|
+// val iv = Base64.decode(ivBase64, Base64.DEFAULT)
|
|
|
val encryptedBytes = Base64.decode(encryptedBase64, Base64.DEFAULT)
|
|
|
- val ivSpec = IvParameterSpec(iv)
|
|
|
+ val ivSpec = IvParameterSpec(ivKey.toByteArray(Charsets.UTF_8))
|
|
|
val secKey: SecretKey = SecretKeySpec(secretKeyString.toByteArray(Charsets.UTF_8), "AES")
|
|
|
|
|
|
val cipher = Cipher.getInstance("AES/CBC/PKCS5Padding")
|
|
@@ -64,7 +64,7 @@ class Utils {
|
|
|
// val encodedSaltKey = Base64.encodeToString(filterSaltKey.toByteArray(Charsets.UTF_8), Base64.DEFAULT)
|
|
|
// val salt16Length = encodedSaltKey.take(16)
|
|
|
|
|
|
- val saltKey = id.toString().repeat(16).takeLast(16)
|
|
|
+ val saltKey = id.toString().repeat(16).reversed().takeLast(16)
|
|
|
return saltKey
|
|
|
}
|
|
|
|