Read DER-encoded RSA public key in memory?

2009-07-20 Thread Jeremy R.
I'm trying to make a simple application which uses a 4096-bit RSA public key (encoded in DER format, statically compiled into the program itself. I generated this key with OpenSSL itself and I am able to do operations with it from the command-line. And I know I encoded it in the program cor

Re: Read DER-encoded RSA public key in memory?

2009-07-20 Thread Mounir IDRASSI
Hi, The public key in your source is encoded as a SubjectPublicKeyInfo, so you can't use d2i_PublicKey which only handles RSA public keys encoded in the PKCS#1 format. In your case, you have to use the function d2i_PUBKEY_bio to read your hard-coded key. Here is how you can do it using the sa

Re: Read DER-encoded RSA public key in memory?

2009-07-20 Thread Jeremy R.
Thanks. I switched to using d2i_PUBKEY (it really is hard-coded, so I don't think there's a reason to use BIO – if I'm mistaken, please tell me) and it now returns a valid address in memory. On 20-Jul-09, at 4:59 PM, Mounir IDRASSI wrote: Hi, The public key in your source is encoded as a S

Re: Read DER-encoded RSA public key in memory?

2009-07-20 Thread Mounir IDRASSI
Yes, d2i_PUBKEY is sufficient. -- Mounir IDRASSI IDRIX http://www.idrix.fr Jeremy R. wrote: Thanks. I switched to using d2i_PUBKEY (it really is hard-coded, so I don't think there's a reason to use BIO – if I'm mistaken, please tell me) and it now returns a valid address in memory. On 20-Ju