EVP_PKEY-EC - Online Linux Manual PageSection : 7ossl
Updated : 2023-03-21
Source : 3.0.8
Note : OpenSSL

NAMEEVP_PKEY−EC, EVP_KEYMGMT−EC ​− EVP_PKEY EC keytype and algorithm support

DESCRIPTIONThe EC keytype is implemented in OpenSSL's default provider.

Common EC parametersThe normal way of specifying domain parameters for an EC curve is via the curve name "group". For curves with no curve name, explicit parameters can be used that specify "field-type", "p", "a", "b", "generator" and "order". Explicit parameters are supported for backwards compability reasons, but they are not compliant with multiple standards (including RFC5915) which only allow named curves. The following KeyGen/Gettable/Import/Export types are available for the built-in EC algorithm: .IP """group"" (OSSL_PKEY_PARAM_GROUP_NAME) <UTF8 string>" 4 The curve name. .IP """field-type"" (OSSL_PKEY_PARAM_EC_FIELD_TYPE) <UTF8 string>" 4 The value should be either "prime-field" or "characteristic-two-field", which correspond to prime field Fp and binary field F2^m. .IP """p"" (OSSL_PKEY_PARAM_EC_P) <unsigned integer>" 4 For a curve over Fp p is the prime for the field. For a curve over F2^m p represents the irreducible polynomial − each bit represents a term in the polynomial. Therefore, there will either be three or five bits set dependent on whether the polynomial is a trinomial or a pentanomial. .IP """a"" (OSSL_PKEY_PARAM_EC_A) <unsigned integer>" 4 .IP """b"" (OSSL_PKEY_PARAM_EC_B) <unsigned integer>" 4 .IP """seed"" (OSSL_PKEY_PARAM_EC_SEED) <octet string>" 4 ​a and b represents the coefficients of the curve For Fp: y^2 mod p = x^3 +ax + b mod p OR For F2^m: y^2 + xy = x^3 + ax^2 + b seed is an optional value that is for information purposes only. It represents the random number seed used to generate the coefficient b from a random number. .IP """generator"" (OSSL_PKEY_PARAM_EC_GENERATOR) <octet string>" 4 .IP """order"" (OSSL_PKEY_PARAM_EC_ORDER) <unsigned integer>" 4 .IP """cofactor"" (OSSL_PKEY_PARAM_EC_COFACTOR) <unsigned integer>" 4 The generator is a well defined point on the curve chosen for cryptographic operations. The encoding conforms with Sec. 2.3.3 of the SECG SEC 1 ("Elliptic Curve Cryptography") standard. See EC_POINT_oct2point(). Integers used for point multiplications will be between 0 and ​order − 1. ​cofactor is an optional value. ​order multiplied by the cofactor gives the number of points on the curve. .IP """decoded-from-explicit"" (OSSL_PKEY_PARAM_EC_DECODED_FROM_EXPLICIT_PARAMS) <integer>" 4 Gets a flag indicating wether the key or parameters were decoded from explicit curve parameters. Set to 1 if so or 0 if a named curve was used. .IP """use-cofactor-flag"" (OSSL_PKEY_PARAM_USE_COFACTOR_ECDH) <integer>" 4 Enable Cofactor DH (ECC CDH) if this value is 1, otherwise it uses normal EC DH if the value is zero. The cofactor variant multiplies the shared secret by the EC curve's cofactor (note for some curves the cofactor is 1). See also EVP_KEYEXCH−ECDH(7) for the related ​OSSL_EXCHANGE_PARAM_EC_ECDH_COFACTOR_MODE parameter that can be set on a per-operation basis. .IP """encoding"" (OSSL_PKEY_PARAM_EC_ENCODING) <UTF8 string>" 4 Set the format used for serializing the EC group parameters. Valid values are "explicit" or "named_curve". The default value is "named_curve". .IP """point-format"" (OSSL_PKEY_PARAM_EC_POINT_CONVERSION_FORMAT) <UTF8 string>" 4 Sets or gets the point_conversion_form for the key. For a description of point_conversion_forms please see EC_POINT_new(3). Valid values are "uncompressed" or "compressed". The default value is "uncompressed". .IP """group-check"" (OSSL_PKEY_PARAM_EC_GROUP_CHECK_TYPE) <UTF8 string>" 4 Sets or Gets the type of group check done when EVP_PKEY_param_check() is called. Valid values are "default", "named" and "named-nist". The "named" type checks that the domain parameters match the inbuilt curve parameters, "named-nist" is similiar but also checks that the named curve is a nist curve. The "default" type does domain parameter validation for the OpenSSL default provider, but is equivalent to "named-nist" for the OpenSSL FIPS provider. .IP """include-public"" (OSSL_PKEY_PARAM_EC_INCLUDE_PUBLIC) <integer>" 4 Setting this value to 0 indicates that the public key should not be included when encoding the private key. The default value of 1 will include the public key. .IP """pub"" (OSSL_PKEY_PARAM_PUB_KEY) <octet string>" 4 The public key value in encoded EC point format conforming to Sec. 2.3.3 and 2.3.4 of the SECG SEC 1 ("Elliptic Curve Cryptography") standard. This parameter is used when importing or exporting the public key value with the ​EVP_PKEY_fromdata() and EVP_PKEY_todata() functions. Note, in particular, that the choice of point compression format used for encoding the exported value via EVP_PKEY_todata() depends on the underlying provider implementation. Before OpenSSL 3.0.8, the implementation of providers included with OpenSSL always opted for an encoding in compressed format, unconditionally. Since OpenSSL 3.0.8, the implementation has been changed to honor the ​OSSL_PKEY_PARAM_EC_POINT_CONVERSION_FORMAT parameter, if set, or to default to uncompressed format. .IP """priv"" (OSSL_PKEY_PARAM_PRIV_KEY) <unsigned integer>" 4 The private key value. .IP """encoded-pub-key"" (OSSL_PKEY_PARAM_ENCODED_PUBLIC_KEY) <octet string>" 4 Used for getting and setting the encoding of an EC public key. The public key is expected to be a point conforming to Sec. 2.3.4 of the SECG SEC 1 ("Elliptic Curve Cryptography") standard. .IP """qx"" (OSSL_PKEY_PARAM_EC_PUB_X) <unsigned integer>" 4 Used for getting the EC public key X component. .IP """qy"" (OSSL_PKEY_PARAM_EC_PUB_Y) <unsigned integer>" 4 Used for getting the EC public key Y component. (OSSL_PKEY_PARAM_DEFAULT_DIGEST) <UTF8 string> Getter that returns the default digest name. (Currently returns "SHA256" as of OpenSSL 3.0). The following Gettable types are also available for the built-in EC algorithm: .IP """basis-type"" (OSSL_PKEY_PARAM_EC_CHAR2_TYPE) <UTF8 string>" 4 Supports the values "tpBasis" for a trinomial or "ppBasis" for a pentanomial. This field is only used for a binary field F2^m. .IP """m"" (OSSL_PKEY_PARAM_EC_CHAR2_M) <integer>" 4 .IP """tp"" (OSSL_PKEY_PARAM_EC_CHAR2_TP_BASIS) <integer>" 4 .IP """k1"" (OSSL_PKEY_PARAM_EC_CHAR2_PP_K1) <integer>" 4 .IP """k2"" (OSSL_PKEY_PARAM_EC_CHAR2_PP_K2) <integer>" 4 .IP """k3"" (OSSL_PKEY_PARAM_EC_CHAR2_PP_K3) <integer>" 4 These fields are only used for a binary field F2^m. ​m is the degree of the binary field. tp is the middle bit of a trinomial so its value must be in the range m > tp > 0. k1, k2 and k3 are used to get the middle bits of a pentanomial such that m > k3 > k2 > k1 > 0

EC key validationFor EC keys, EVP_PKEY_param_check(3) behaves in the following way: For the OpenSSL default provider it uses either ​EC_GROUP_check(3) or EC_GROUP_check_named_curve(3) depending on the flag EC_FLAG_CHECK_NAMED_GROUP. The OpenSSL FIPS provider uses EC_GROUP_check_named_curve(3) in order to conform to SP800−56Ar3 Assurances of Domain-Parameter Validity. For EC keys, EVP_PKEY_param_check_quick(3) is equivalent to ​EVP_PKEY_param_check(3). For EC keys, EVP_PKEY_public_check(3) and EVP_PKEY_public_check_quick(3) conform to SP800−56Ar3 ECC Full Public-Key Validation and ​ECC Partial Public-Key Validation respectively. For EC Keys, EVP_PKEY_private_check(3) and EVP_PKEY_pairwise_check(3) conform to SP800−56Ar3 Private key validity and ​Owner Assurance of Pair-wise Consistency respectively.

EXAMPLESAn EVP_PKEY context can be obtained by calling: ​ EVP_PKEY_CTX *pctx = ​ EVP_PKEY_CTX_new_from_name(NULL, "EC", NULL); An EVP_PKEY ECDSA or ECDH key can be generated with a "P−256" named group by calling: ​ pkey = EVP_EC_gen("P−256"); or like this: ​ EVP_PKEY *key = NULL; ​ OSSL_PARAM params[2]; ​ EVP_PKEY_CTX *gctx = ​ EVP_PKEY_CTX_new_from_name(NULL, "EC", NULL); ​ ​ EVP_PKEY_keygen_init(gctx); ​ ​ params[0] = OSSL_PARAM_construct_utf8_string(OSSL_PKEY_PARAM_GROUP_NAME, ​ "P−256", 0); ​ params[1] = OSSL_PARAM_construct_end(); ​ EVP_PKEY_CTX_set_params(gctx, params); ​ ​ EVP_PKEY_generate(gctx, &key); ​ ​ EVP_PKEY_print_private(bio_out, key, 0, NULL); ​ ... ​ EVP_PKEY_free(key); ​ EVP_PKEY_CTX_free(gctx); An EVP_PKEY EC CDH (Cofactor Diffie-Hellman) key can be generated with a "K−571" named group by calling: ​ int use_cdh = 1; ​ EVP_PKEY *key = NULL; ​ OSSL_PARAM params[3]; ​ EVP_PKEY_CTX *gctx = ​ EVP_PKEY_CTX_new_from_name(NULL, "EC", NULL); ​ ​ EVP_PKEY_keygen_init(gctx); ​ ​ params[0] = OSSL_PARAM_construct_utf8_string(OSSL_PKEY_PARAM_GROUP_NAME, ​ "K−571", 0); ​ /* ​ * This curve has a cofactor that is not 1 − so setting CDH mode changes ​ * the behaviour. For many curves the cofactor is 1 − so setting this has ​ * no effect. ​ */ ​ params[1] = OSSL_PARAM_construct_int(OSSL_PKEY_PARAM_USE_COFACTOR_ECDH, ​ &use_cdh); ​ params[2] = OSSL_PARAM_construct_end(); ​ EVP_PKEY_CTX_set_params(gctx, params); ​ ​ EVP_PKEY_generate(gctx, &key); ​ EVP_PKEY_print_private(bio_out, key, 0, NULL); ​ ... ​ EVP_PKEY_free(key); ​ EVP_PKEY_CTX_free(gctx);

SEE ALSOEVP_EC_gen(3), ​EVP_KEYMGMT(3), ​EVP_PKEY(3), ​provider−keymgmt(7), ​EVP_SIGNATURE−ECDSA(7), ​EVP_KEYEXCH−ECDH(7)

COPYRIGHTCopyright 2020−2022 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.
0
Johanes Gumabo
Data Size   :   32,795 byte
man-EVP_KEYMGMT-EC.7osslBuild   :   2024-12-05, 20:55   :  
Visitor Screen   :   x
Visitor Counter ( page / site )   :   3 / 192,152
Visitor ID   :     :  
Visitor IP   :   3.14.245.172   :  
Visitor Provider   :   AMAZON-02   :  
Provider Position ( lat x lon )   :   39.962500 x -83.006100   :   x
Provider Accuracy Radius ( km )   :   1000   :  
Provider City   :   Columbus   :  
Provider Province   :   Ohio ,   :   ,
Provider Country   :   United States   :  
Provider Continent   :   North America   :  
Visitor Recorder   :   Version   :  
Visitor Recorder   :   Library   :  
Online Linux Manual Page   :   Version   :   Online Linux Manual Page - Fedora.40 - march=x86-64 - mtune=generic - 24.12.05
Online Linux Manual Page   :   Library   :   lib_c - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Online Linux Manual Page   :   Library   :   lib_m - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Data Base   :   Version   :   Online Linux Manual Page Database - 24.04.13 - march=x86-64 - mtune=generic - fedora-38
Data Base   :   Library   :   lib_c - 23.02.07 - march=x86-64 - mtune=generic - fedora.36

Very long time ago, I have the best tutor, Wenzel Svojanovsky . If someone knows the email address of Wenzel Svojanovsky , please send an email to johanes_gumabo@yahoo.co.id .
If error, please print screen and send to johanes_gumabo@yahoo.co.id
Under development. Support me via PayPal.

ERROR : Need New Coding :         (parse_manual_page_|249|EVP_PKEY-EC.7ossl|24/25|el══─{─══.|.el══─{─══. ds C` )         (htmlprn|149|EVP_PKEY-EC.7ossl|24/25|.el══─{─══. ds C` |.el══─{─══. ds C` )         (parse_manual_page_|249|EVP_PKEY-EC.7ossl|27|br══─}─══|'br══─}─══ )         (htmlprn|149|EVP_PKEY-EC.7ossl|27|'br══─}─══ |'br══─}─══ )         (rof_IP|5|EVP_PKEY-EC.7ossl|81|5|.IP """group"" (\fBOSSL_PKEY_PARAM_GROUP_NAME\fR) " 4 )         (rof_IP|5|EVP_PKEY-EC.7ossl|84|5|.IP """field-type"" (\fBOSSL_PKEY_PARAM_EC_FIELD_TYPE\fR) " 4 )         (rof_IP|5|EVP_PKEY-EC.7ossl|88|5|.IP """p"" (\fBOSSL_PKEY_PARAM_EC_P\fR) " 4 )         (rof_IP|5|EVP_PKEY-EC.7ossl|94|5|.IP """a"" (\fBOSSL_PKEY_PARAM_EC_A\fR) " 4 )         (rof_IP|5|EVP_PKEY-EC.7ossl|97|5|.IP """b"" (\fBOSSL_PKEY_PARAM_EC_B\fR) " 4 )         (rof_IP|5|EVP_PKEY-EC.7ossl|99|5|.IP """seed"" (\fBOSSL_PKEY_PARAM_EC_SEED\fR) " 4 )         (rof_IP|5|EVP_PKEY-EC.7ossl|109|5|.IP """generator"" (\fBOSSL_PKEY_PARAM_EC_GENERATOR\fR) " 4 )         (rof_IP|5|EVP_PKEY-EC.7ossl|112|5|.IP """order"" (\fBOSSL_PKEY_PARAM_EC_ORDER\fR) " 4 )         (rof_IP|5|EVP_PKEY-EC.7ossl|114|5|.IP """cofactor"" (\fBOSSL_PKEY_PARAM_EC_COFACTOR\fR) " 4 )         (rof_IP|5|EVP_PKEY-EC.7ossl|124|5|.IP """decoded-from-explicit"" (\fBOSSL_PKEY_PARAM_EC_DECODED_FROM_EXPLICIT_PARAMS\fR) " 4 )         (rof_IP|5|EVP_PKEY-EC.7ossl|128|5|.IP """use-cofactor-flag"" (\fBOSSL_PKEY_PARAM_USE_COFACTOR_ECDH\fR) " 4 )         (rof_IP|5|EVP_PKEY-EC.7ossl|137|5|.IP """encoding"" (\fBOSSL_PKEY_PARAM_EC_ENCODING\fR) " 4 )         (rof_IP|5|EVP_PKEY-EC.7ossl|141|5|.IP """point-format"" (\fBOSSL_PKEY_PARAM_EC_POINT_CONVERSION_FORMAT\fR) " 4 )         (rof_IP|5|EVP_PKEY-EC.7ossl|146|5|.IP """group-check"" (\fBOSSL_PKEY_PARAM_EC_GROUP_CHECK_TYPE\fR) " 4 )         (rof_IP|5|EVP_PKEY-EC.7ossl|154|5|.IP """include-public"" (\fBOSSL_PKEY_PARAM_EC_INCLUDE_PUBLIC\fR) " 4 )         (rof_IP|5|EVP_PKEY-EC.7ossl|158|5|.IP """pub"" (\fBOSSL_PKEY_PARAM_PUB_KEY\fR) " 4 )         (rof_IP|5|EVP_PKEY-EC.7ossl|173|5|.IP """priv"" (\fBOSSL_PKEY_PARAM_PRIV_KEY\fR) " 4 )         (rof_IP|5|EVP_PKEY-EC.7ossl|176|5|.IP """encoded-pub-key"" (\fBOSSL_PKEY_PARAM_ENCODED_PUBLIC_KEY\fR) " 4 )         (rof_IP|5|EVP_PKEY-EC.7ossl|181|5|.IP """qx"" (\fBOSSL_PKEY_PARAM_EC_PUB_X\fR) " 4 )         (rof_IP|5|EVP_PKEY-EC.7ossl|184|5|.IP """qy"" (\fBOSSL_PKEY_PARAM_EC_PUB_Y\fR) " 4 )         (rof_IP|5|EVP_PKEY-EC.7ossl|193|5|.IP """basis-type"" (\fBOSSL_PKEY_PARAM_EC_CHAR2_TYPE\fR) " 4 )         (rof_IP|5|EVP_PKEY-EC.7ossl|197|5|.IP """m"" (\fBOSSL_PKEY_PARAM_EC_CHAR2_M\fR) " 4 )         (rof_IP|5|EVP_PKEY-EC.7ossl|200|5|.IP """tp"" (\fBOSSL_PKEY_PARAM_EC_CHAR2_TP_BASIS\fR) " 4 )         (rof_IP|5|EVP_PKEY-EC.7ossl|202|5|.IP """k1"" (\fBOSSL_PKEY_PARAM_EC_CHAR2_PP_K1\fR) " 4 )         (rof_IP|5|EVP_PKEY-EC.7ossl|204|5|.IP """k2"" (\fBOSSL_PKEY_PARAM_EC_CHAR2_PP_K2\fR) " 4 )         (rof_IP|5|EVP_PKEY-EC.7ossl|206|5|.IP """k3"" (\fBOSSL_PKEY_PARAM_EC_CHAR2_PP_K3\fR) " 4 )