Public_key in X509 format?

Hi All,

Is there any way to get an RSA public key in X509 format? By default
RSA pub keys are dumped out in PKCS#1 format but I really need X509.
I know that the C call that's being used to create the public key is
PEM_write_bio_RSAPublicKey and I don't see any reference to
PEM_write_bio_PUBKEY, so I'm guessing somehow converting from one to
the other is my only choice.

So is there some way to use the current APIs to convert from that
PKCS#1 format to X509?

···

--
Paul Haddad (paul.haddad@gmail.com paul@pth.com)

So is there some way to use the current APIs to convert from that
PKCS#1 format to X509?

X509 is the structure used for certificates that contains the
identifying information about the certificate along with the public
key. There is no such thing as a public key in X509 format.
Sometimes people refer to certificates as public key certificates,
because the certificate always has a public key component.

Chris

Hi,

Paul Haddad wrote:

So is there some way to use the current APIs to convert from that
PKCS#1 format to X509?

ASN.1 DER + base64?

0% ruby -ropenssl -e
'OpenSSL::PKey::RSA.new(1024).public_key.to_pem.display'
- -----BEGIN RSA PUBLIC KEY-----
MIGJAoGBAL8KLG/KSWzi48EMsa6cNlWwXKIrDUjn3dsoWv5fF31J/PUkg0ULw45I
kBapGw+9iUcfUIOegY80d+WDTO56F0OhLNA4+0huAPfcdVASDnbhyYTn8mQgv2Rf
qUEvL5+bnacbmN0NVhg9PhljZci2hEFsUDcJP2OX+pbcmXfvnVjbAgMBAAE=
- -----END RSA PUBLIC KEY-----

You may be interested in PKCS#1 encoder in http://dev.ctor.org/pkcs1

Regards,
// NaHi

Chris,

···

On 9/11/06, snacktime <snacktime@gmail.com> wrote:

X509 is the structure used for certificates that contains the
identifying information about the certificate along with the public
key. There is no such thing as a public key in X509 format.
Sometimes people refer to certificates as public key certificates,
because the certificate always has a public key component.

I guess I used the wrong terminology I meant the key in X509
SubjectPublicKeyInfo, or to be more precise the one that has

-----BEGIN PUBLIC KEY-----

at the top.
--
Paul Haddad (paul.haddad@gmail.com paul@pth.com)