openssl 3.0.0 get ECC public key modulus from EVP_PKEY

Ken Goldman kgoldman at us.ibm.com
Thu Oct 14 21:36:48 UTC 2021


On 10/14/2021 6:39 AM, Matt Caswell wrote:
> 
> "priv" (OSSL_PKEY_PARAM_PRIV_KEY) <unsigned integer>
> 
> The private key value.
> 
> Since its an integer using EVP_PKEY_get_bn_param() would be appropriate here, but not EVP_PKEY_get_octet_string_param().
> 
> Basically you need to know the type of the parameter you are attempting to access and use the right kind of "getter" to match the type - otherwise it will fail.

That helped!

https://www.openssl.org/docs/manmaster/man7/EVP_PKEY-EC.html

I found that page a bit confusing.  Is it right that

<unsigned integer>
<integer>

are all actually BIGNUM?  I.e., not C int or unsigned int?

~~~~~~~~~~~~~~~~

While I'm on that page:

<UTF8 string> should call EVP_PKEY_get_utf8_string_param().  This seems to require an allocated array.
How does one find the size to allocate?  Does it follow the typical "if buf is NULL, return just the size"
so it can be malloced.

<octet string> same question.



More information about the openssl-users mailing list