On Tue, Mar 04, 2014, Jeffrey Walton wrote:

> On Tue, Mar 4, 2014 at 2:25 PM, Dr. Stephen Henson <st...@openssl.org> wrote:
> > On Tue, Mar 04, 2014, Jeffrey Walton wrote:
> >
> >> If that's the case, then that's probably it. Below is a sample.
> >>
> >> I've been using PEM_write_PKCS8PrivateKey and PEM_write_X509. What
> >> does one use to write the named curve?
> >>
> >
> > It is stored in the private key when the key is generated. How did you
> > generate it?
> >
>   int nid = ...
>   EC_KEY* key = EC_KEY_new_by_curve_name(nid);
>   int rc = EC_KEY_generate_key(key);
> 
>   EVP_PKEY * pkey = EVP_PKEY_new();
>   rc = EVP_PKEY_assign_EC_KEY(pkey, key);
> 

Ah, the default is unfortunately to use explicit parameters. You can change
that with:

        EC_KEY_set_asn1_flag(key, OPENSSL_EC_NAMED_CURVE);

Steve.
--
Dr Stephen N. Henson. OpenSSL project core developer.
Commercial tech support now available see: http://www.openssl.org
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to