I’d like to leave the user the possibility to choice the encryption method, but for now I implemented just AES with SHA1PRNG. With AES/CBC/PKCS5Padding it doesn’t work.
What does other encryption method work with android?
I have to encrypt data to store them in a db and then decrypt for show them.
The error returned:
java.security.NoSuchAlgorithmException: SecureRandom AES/CBC/PKCS5Padding implementation not found
here:
SecureRandom.getInstance( "AES/CBC/PKCS5Padding" );
Do you want to use a random number generator (which is what SecureRandom is for), or do you want to use an encryption algorithm (which is what AES is for)?
If you want an encryption algorithm (and its implementation), use the
javax.crypto.Cipherclass, which should support yourAES/CBC/PKCS5Paddingalgorithm.In principle you can use AES to build an RNG, too, but then you would not use
CBC/PKCS5Padding, but something like ANSI X9.31. I don’t think this is implemented in any Java and/or Android API for SecureRandom.