I linked the code on an external site because it was longer than a snippet. 

I found the answer to my 
question<http://stackoverflow.com/questions/4598873/how-to-handle-last-block-incomplete-in-decryption>,
 
though, through the help of some people on StackOverflow. 

First of all, I had an error with the key generation, but that was simply an 
oversight. The actual issue was that I was encoding the ciphertext directly 
from a byte[] to a String, which means I could lose data if the default 
encoding didn't know what the byte in question was. I changed it so in the 
string encrypt method, the ciphertext that is returned is encoded to Base64 
from the byte array, and in the decrypt method the ciphertext string is 
Base64 decoded into a byte array. This means that data is no longer lost and 
the code now works.

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to