Skip to Main Content

Java Security

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

SunJCE RSACipher Decrypt Problem w/ BouncyCastle RSACipher Encryption

843811May 10 2006 — edited Jul 11 2006
I have a Java 1.4 Application using the BouncyCastle API's RSACipher to encrypt a small clear text value into a database. The cipher algorithm being used is "RSA/ECB/NoPadding". The RSA key was generated by keytool and is stored in a keystore file. I also have a Java 1.5 application trying to read the database and decrypt the value using the same key from the keystore. The Java 1.5 application is creating the Cipher using the SunJCE provider using the same algorithm "RSA/ECB/NoPadding". Upon decrypting I receive a whole bunch of strange characters preceding the cleartext value.

I have tried a simple example of encrypting and decrypting in JDK1.5 only and I get the same results: I encrypt using the BouncyCastle provider (JDK 1.5 version) and decrypt using SunJCE and still receive the same set of characters. I have also tried the reverse - encrypt using SunJCE and decrypt using BouncyCastle and I DO NOT receive the strange characters - the clear text is correctly recovered.

What could possibly be causing these unreadable characters to appear before the clear text value.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 8 2006
Added on May 10 2006
12 comments
1,265 views