On Fri, Jan 25, 2013 at 05:10:03PM +0000, Viktor Dukhovni wrote: > On Fri, Jan 25, 2013 at 04:13:02PM +0000, Ken Allen wrote: > > > Hi All, I'm having a bit of a problem. I need to load a private > > key (EC, but I'm having the same problem with RSA) from an unecrypted, > > der encoded, PKCS8 memory buffer. I'm just trying to get it to work > > loading from a file for now and it's simply not working. Can someone > > tell me what I'm doing wrong? > > If it is not encrypted, it is not really PKCS8, at least in the sense > that it is a different ASN.1 data structure, the code that works is: > > - EVP_PKEY *key = d2i_PKCS8PrivateKey_fp(f, NULL, NULL, NULL); > + EVP_PKEY *key = d2i_PrivateKey_fp(f, NULL);
I should perhaps mention that this is with OpenSSL 1.0 or later, which the OP is probably using given that he's using EC keys. In OpenSSL 0.9.8 d2i_PrivateKey_fp expects an RSA key. -- Viktor. ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager majord...@openssl.org