aspose file tools
The moose likes Security and the fly likes RSA decryption on mobile Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Engineering » Security
Reply Bookmark "RSA decryption on mobile" Watch "RSA decryption on mobile" New topic
Author

RSA decryption on mobile

Anuradha Karunamuni
Ranch Hand

Joined: Dec 08, 2007
Posts: 64
Hi all,

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~
SCJP 1.4
Anuradha Karunamuni
Ranch Hand

Joined: Dec 08, 2007
Posts: 64
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.)
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: RSA decryption on mobile
 
Similar Threads
Problem encrypting with openssl, decrypting with bouncy castle
DSA Encryption In Javascript & Java
encryption decryption
help needed to implement encryption and decryption
Error while encrypting the xml file using asymmetric cipher...pls help