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!

How to convert String Modulus and the Exponent to BigInteger?

843811Jan 18 2010 — edited Jan 18 2010
Hello,

We are implementing SSO with a client and they don't work with certificates but with the RSA key itself.
Below is an example of the file they expect to exchange which is the RSA public key:

<RSAKeyValue><Modulus>0siL9/q6RKwrrwEu0g1uP4bqNv+9moUdxDOG2CqgPWUbBrvT9Wbzp9ujQHJ73Wu+hgNWMKmm7gxUZfaK52Yq9dsjTS8RMBUT78SGjJe77mmE0jryaw3Dtvk3Ax8bOlStJUXPsE2uuDrb5PblrOVR6zb3GVGryT8zhD+sYk67RI0=</Modulus><Exponent>AQAB</Exponent></RSAKeyValue>

I am trying to develop a utility that will convert this into a standard X509 certificate file and was able to find a very useful code in the Bouncy Castle API.
The API expects the object PublicKey so what I need is to create an RSAPublicKey object from the information above.
The RSAPublicKeySpec can help but it expects the Modulus and the Exponent as BigIntegers.
Any idea how can I convert the Modulus and the Exponent above to valid BigIntegers without compromising the data?

Thanks,
Roy
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 15 2010
Added on Jan 18 2010
5 comments
1,015 views