I am developing a J2ME application which uses Bouncy Castle crypto API to handle the security. I use RSA public and private keys to encrypt and decrypt the strings which are SMS messages.
The encryption is done using the public key and it executes successfully. But when I try to decrypt the encrypted text using the private key it gives the following Exception;
InvalidCipherTextException: unknown block type Exception
If any of you aware of a solution to overcome this, please let me know.
Thanks in advance.
"Simplicity is the ultimate sophistication..." ~Leonardo da Vinci~
Joined: Dec 08, 2007
I manged to fix the problem.
It was some encoding issue. I encoded the byte before encryption using Base64 and decoded the byte to be decrypted using Base64. Then the problem was solved. (You can use either Base64 or Hex for encoding and decoding. Both work fine.)