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!

RSA - Encryption (C#) - Decryption (Java)

843811Jul 3 2008 — edited Jul 16 2008
Hi All,

We used RSA algorithm for encryption mechanism. It's done in C# and it generated public and private XML files.

Now we want to decrypt the message in Java using privatekey.xml.
"<BitStrength>512</BitStrength>
<RSAKeyValue>
<Modulus>bp+VnREDCrjXk2rYLO8Cw==</Modulus>
<Exponent>AB</Exponent>
<P>9RaE0bETZDNbTAUs=</P>
<Q>y9ZkzQAmrdvjyA4L+5CIEE=</Q>
<DP>GdARrJTH4/FQwmc=</DP>
<DQ>SEH3+Uhd9nvsAE=</DQ>
<InverseQ>ZssVlzUgA8hE=</InverseQ>
<D>vssaRCZSkm3RClMTCyVyRnjIAQ==</D>
</RSAKeyValue>" 
By googling we got a class RSAPrivateCrtKeySpec which accepts 8 parameters which are there in xml -
public RSAPrivateCrtKeySpec(BigInteger modulus,
                            BigInteger publicExponent,
                            BigInteger privateExponent,
                            BigInteger primeP,
                            BigInteger primeQ,
                            BigInteger primeExponentP,
                            BigInteger primeExponentQ,
                            BigInteger crtCoefficient)
I have provided all the values and it's throwing NumberFormatException because values contain =+u/ etc...

Please advice me of how to approach this problem.

Thanks,
Kranthi Kiran
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 13 2008
Added on Jul 3 2008
8 comments
1,776 views