I am trying to encrypt and decrypt Strings in my Android application but I keep getting an InvalidKeyException error.
Here is my code:
//Generate Keys method
Removing the provider worked for me:
Cipher.getInstance("RSA/ECB/PKCS1Padding")
From Java docs: "This method traverses the list of registered security Providers, starting with the most preferred Provider. A new Cipher object encapsulating the CipherSpi implementation from the first Provider that supports the specified algorithm is returned."