I'm having some trouble trying to decrypt a file (xml-based) encrypted with AES 128 bit (using C# and RijndaelManaged). Further more it uses PKCS5.
I'm not able to get this to work and have not been able to decrypt the file.
I'm using the Encryption Library written by Andrew Graham in B4A.
Here's the code I'm using (it's derived from another code posted in this forum):
The exception I get when trying to decrypt the file is: "java.security.InvalidKeyException, Unsupported key size: 7 bytes"
I'm obviously doing something wrong here...
Any help is appreciated.
I'm not able to get this to work and have not been able to decrypt the file.
I'm using the Encryption Library written by Andrew Graham in B4A.
Here's the code I'm using (it's derived from another code posted in this forum):
B4X:
Sub Decrypt(encryptedData As String ) As String
Dim kg As KeyGenerator
Dim c As Cipher
Dim B64 As Base64
Dim Bconv As ByteConverter
Dim data(0) As Byte
Dim p As String
Dim md As MessageDigest
c.Initialize("AES/CBC/PKCS5Padding")
kg.Initialize("AES")
p = "password"
kg.KeyFromBytes(p.GetBytes("UTF8"))
data = B64.DecodeStoB(encryptedData)
data = c.Decrypt(data, kg.Key, False)
Return Bconv.StringFromBytes(data, "UTF8")
End Sub
The exception I get when trying to decrypt the file is: "java.security.InvalidKeyException, Unsupported key size: 7 bytes"
I'm obviously doing something wrong here...
Any help is appreciated.