This is my code for AES.
Under Gingerbread I get following error after encrypting the data on 2.2 then trying to decrypt on 2.3:
Caused by: javax.crypto.BadPaddingException: pad block corrupted
at org.bouncycastle.jce.provider.JCEBlockCipher.engineDoFinal(JCEBlockCipher.java:715)
at javax.crypto.Cipher.doFinal(Cipher.java:1090)
at com.citc.wallet.util.security.SimpleCrypto.decrypt(SimpleCrypto.java:63)
... 21 more
I have found some posts saying that SecureRandom
is producing different results under different systems:
BouncyCastle AES error when upgrading to 1.45
How do I avoid this problem on 2.3?
Can I somehow force 2.3 to use the same SecureRandom class?
Do I need to use some portable encryption method and if so what?