Hello,
Thank you so much for your response. I already sent an email to ask my 
colleague to find out what curve I should use. However, when I tried using 
either NID_secp256k1 or NID_X9_62_prime256v1 (because they are the only two 
curves of 256 bit). I keep getting segmentation fault, so I never saw the print 
out of "Got here 2" from my code:

printf("Got here 1!\r\n");
  EC_KEY *eckey; = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1); // or 
NID_secp256k1
    printf("Got here 2!\r\n");
  if(eckey == NULL)
  {
    printf("ERROR: NULL EC_KEY!\r\n");
    return 0;
  }
I know it's very likely to be user's error again (sorry I'm new at openssl). 
But do you guys know the cause of this seg fault? Thank you very much.
________________________________________
From: owner-openssl-us...@openssl.org [owner-openssl-us...@openssl.org] on 
behalf of Matt Caswell (fr...@baggins.org) [fr...@baggins.org]
Sent: Tuesday, May 22, 2012 11:08 AM
To: openssl-users@openssl.org
Subject: Re: EC_KEY_new_by_curve_name returns NULL

Sorry one other point. Just noticed that in one of your other posts,
you have been provided with a previously existing private key. In that
case you need to find out what curve that private key was associated
with.

Matt

On 22 May 2012 17:04, Matt Caswell (fr...@baggins.org)
<fr...@baggins.org> wrote:
> NID_ecdsa_with_SHA256 is not the name of a curve.
>
> NID_secp256k1 is probably a good choice. Refer to the following
> document for a discussion on recommended curves (appendix d), and then
> find the related NID name for the curve you want in OpenSSL:
> http://csrc.nist.gov/publications/fips/fips186-3/fips_186-3.pdf
>
> Matt
>
>
> On 22 May 2012 16:07, Khuc, Chuong D. <ck...@swri.org> wrote:
>> Hi,
>> I got a problem with
>> EC_KEY_new_by_curve_name: it always return NULL. Here is how I used it:
>> EC_KEY *eckey = EC_KEY_new_by_curve_name(NID_ecdsa_with_SHA256);
>> If(eckey == NULL)
>> {
>>  printf("ERROR: NULL ECKEY!\r\n");
>> }
>> Do you happen to know the reason?
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@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