I am implementing a demo for RSA Encryption and Decryption in Android. I can Perform Encryption very well, but In Decryption I get an Exception: >>java.security.
when using RSAEcvypt method, its fill PublicKey and private key. And when your Decrypt your generated byte[], your publicKey and privateKey being NULL. Because of that you get this error.
You should use your keys static;
enter code here
KeyPairGenerator kpg;
KeyPair kp;
static PublicKey publicKey;
static PrivateKey privateKey;
byte [] encryptedBytes,decryptedBytes;
Cipher cipher,cipher1;
String encrypted,decrypted;