Re: Asymmetric key pairs storage format
- From: Thomas Pornin <pornin@xxxxxxxxx>
- Date: 14 May 2008 21:18:47 GMT
According to <1.41421@xxxxxxxxx>:
I would be interested to store RSA and DSA key pairs (that is,
both private and public keys) to persistent storage in a platform-
independent way. I am not aware of any officially anointed formats out
there for this purpose, but maybe somebody in this forum knows better.
For RSA, PKCS#1 includes an ASN.1 syntax for a serialization format
of a RSA private key. It so happens that the RSA private key includes
the modulus and public exponent, i.e. all the elements which constitute
the public key, hence that serialized private key can be viewed as
a serialized key pair.
For DSA, there is an ASN.1-based serialization hidden in PKCS#11 (when
talking about wrapping private keys, section 12.6 in version 2.20 of
PKCS#11). Basically, two objects are defined, one holding the DSA
"parameters" (p, q and g) and the other the private key itself as an
INTEGER (the value x). The public key (y) can be recomputed from the
private key through a simple modular exponentiation (y = g^x mod p).
A common "bag" for both formats is PKCS#8. PKCS#8 contains an identifier
for the key type, and then the private key itself serialized in a format
appropriate for that key type.
The PKCS can be downloaded for free from the RSA Labs web site, currently
there:
http://www.rsa.com/rsalabs/node.asp?id=2124
If you are new to ASN.1, you can find some free and detailed information
at:
http://www.oss.com/asn1/larmouth.html
(and you will curse me forever, for sending you unwarned into the
hellish realm of ASN.1.)
Alternatively, you may simply use some existing code which handles
PKCS#8 and knows how to read and write RSA and DSA keys. In the C world,
you may try OpenSSL (www.openssl.org), which is quite common (and free,
and opensource). The Java standard library already contains some support
for PKCS#8.
--Thomas Pornin
.
- Follow-Ups:
- Re: Asymmetric key pairs storage format
- From: Le Chaud Lapin
- Re: Asymmetric key pairs storage format
- References:
- Asymmetric key pairs storage format
- From: 1 . 41421
- Asymmetric key pairs storage format
- Prev by Date: Re: Asymmetric key pairs storage format
- Next by Date: Re: Asymmetric key pairs storage format
- Previous by thread: Re: Asymmetric key pairs storage format
- Next by thread: Re: Asymmetric key pairs storage format
- Index(es):
Relevant Pages
|
|