I have some problems to encrypt simple strings. The problem is, that an emty string ("") after encrypt and decrypt isn't longer an emty string. It's an array of bytes with a length of 16. How is it possible to get the emty string after decryption?
B4X:
Sub Encrypt(Zeichenkette As String) As Byte()
Dim ByteArray() As Byte
ByteArray=Cipher1.Encrypt(Zeichenkette.GetBytes("UTF8"), "xxxxx")
Return ByteArray
End Sub
Sub Decrypt(Zeichenkette() As Byte) As String
Dim ByteArray() As Byte
ByteArray=Cipher1.Decrypt(Zeichenkette, "xxxxx")
Return BytesToString(ByteArray, 0, ByteArray.Length, "UTF8")
End Sub
I have made more tests and my problem is not only an emty string. If I encrypt for example one string ("test"), and show the result after decryption in the log, the text is "test". But it is not the same because if I check the result with if result="test", then i get a false. The result of my Decrypt-sub is "test" with an length from 16????