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!

Reading PKCS#1 private key from file

843811Feb 4 2008 — edited Feb 7 2008
Hi I'm pretty new to JCE/JSSE. I'd like to read in a PKCS#1 formatted private key from a file. The goal of this is to extract the modulus to validate against a public key (verify they are a key pair).

To accomplish this I can read in the privatekey into a byte array and I tried to create a "RSAPrivateCrtKeySpec" object but the constructor requires many of values I don't directly have (unless i can somehow extract them from the file/byteArray)

Is there a way to do this without relying on external calls to openssl to extract portions of the key from the file?


Thanks for your help,

Chris
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 6 2008
Added on Feb 4 2008
5 comments
8,848 views