RSA 2048 Encryption Decryption - Exception
I am trying to encrypt and decrypt the data with RSA 2048. We have one public key and private key and will be using same throughout. but the problem is, when I decrypt, I am getting javax.crypto.BadPaddingException: Data must start with zero File file = new File("C:\\temp-ldi\\pubkey.txt"); FileWriter writer = new FileWriter(file); file.createNewFile(); encryptedText = RSACrypto.encrypt("PLAIN TEXT"); //no argument of pub-key, generate key pair writer.write(new BASE64Encoder().encode(RSACrypto.pubKeyToBytes(RSACrypto.publicKey))); writer.close(); file = new File("C:\\temp-ldi\\privkey.txt");