OpenSSL 3 ECC Key use question

Tomas Mraz tomas at openssl.org
Mon Oct 24 06:55:06 UTC 2022


What do you need the NID for? Maybe the code could be changed to use
names instead of NIDs? The NIDs are somehow legacy thing that might
eventually be completely internal at some point.

However, if you need the NID, you should be able to use OBJ_sn2nid() to
obtain the NID if the curve name is in the object database.

Tomas Mraz

On Sun, 2022-10-23 at 13:46 -0400, Martin via openssl-users wrote:
> Hi,
>  
> How can I get the nid from the curve name for a EC key in OpenSSL 3?
> I’m porting code from OpenSSL 1.0.2.
>  
> I’m converting this:
>  
> ecc_curve_type = EC_GROUP_get_curve_name(EC_KEY_get0_group((const
> EC_KEY *)eckey));
> if(ecc_curve_type == NID_undef)
> {
>  
> to
>  
> EVP_PKEY_get_utf8_string_param(pkey, OSSL_PKEY_PARAM_GROUP_NAME,
> curve_name, sizeof(curve_name), &out_len);
> ecc_curve_type = ossl_ec_curve_name2nid(curve_name);
>  
> but ossl_ec_curve_name2nid() is internal and it is not defined in
> /include/openssl/ec.h but in /include/crypto/ec.h
>  
> Thanks,
>  
> Martin

-- 
Tomáš Mráz, OpenSSL



More information about the openssl-users mailing list