Android Decryption Error

后端 未结 3 786
甜味超标
甜味超标 2020-12-31 06:40

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

3条回答
  •  既然无缘
    2020-12-31 07:34

    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."

提交回复
热议问题