Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Exporting certificate keys in PEM format

82 views
Skip to first unread message

msnews.microsoft.com

unread,
Feb 16, 2006, 3:24:13 PM2/16/06
to
Hi,

How do I export public/private keys in PEM format from a CSP using the
crypt32 API?

Thanks,

Jan


Mitch Gallant

unread,
Feb 16, 2006, 8:27:25 PM2/16/06
to
PEM format has a few different forms for the RSA private key.
See:
http://www.jensign.com/JavaScience/PEM/pemformats.txt
Basically, PEM format is some form of key in base64 format, wrapped with
Begin .. and End .. lines. For PEM private keys, depending on the format, there
may also be textual data describing the encryption algorithm used (e.g. SSL PrivateKey
traditional PEM format).

For the PEM public key:
-----BEGIN PUBLIC KEY-----
MIGfMA0GCSqGSIb3DQEB .....

the format is b64 encoding of the SubjectPublicKeyInfo structure. You can get that blob from
CryptEncodeObject twice (using Microsoft PUBLICKEYBLOB as the original source blob).
The same blob (before b64 encoding) is returned in Java via PublicKey.getEncoded().

- Mitch Gallant

"msnews.microsoft.com" <j...@acu.no-ip.com> wrote in message
news:uCaNlczM...@TK2MSFTNGP15.phx.gbl...

Jan M

unread,
Feb 17, 2006, 3:11:38 PM2/17/06
to
Hi Mitch,

Thanks. I'll try that.

Regards,

Jan

"Mitch Gallant" <jens...@community.nospam> wrote in message
news:OKv1eF2M...@TK2MSFTNGP14.phx.gbl...

0 new messages