Wednesday, October 21, 2009

[android-developers] string encryption/decryption issues

Hi all,

I am trying to use PBE with 256 bit AES encryption to encrypt and
decrypt strings given a master string password. I ran into problems
when I tried to convert the encrypted byte array into a String (using
new String(byte[] data)), save it then load it and decrypting it after
doing a getBytes() on the encrypted data String.
The problem is that the bytes resulted from the encryption of data
are not the same as the bytes from the String that resulted after
converting the encrypted bytes as stated above.
This probably is due to some String encoding issue I missed or the
way Android encodes and decodes strings from byte arrays since I have
tried various encryption algorithms, even used getBytes("UTF-8") and
still the problem persists.
As a side note, I have used DESede algorithm both on a normal Java
project and in Android and on the Java project, the string encoding/
decoding from byte arrays works perfectly, but on Android I see the
same issue as described above.
Does anyone have any suggestion on how to go about solving this
issue - it is imperative for my application to be able to save the
encrypted data as strings and then load it and decrypt it correctly.

Thanks in advance,
Mihai

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate