Re: openssl 3.0.0 get ECC public key modulus from EVP_PKEY

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2021-10-14 at 17:36 -0400, Ken Goldman wrote:
> 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?

They are unbounded integer values. See OSSL_PARAM(3)

> 
> ~~~~~~~~~~~~~~~~
> 
> 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.

Yes, this should work, except for one caveat - you need to allocate + 1
byte for \0 terminator in case of the UTF8 string. We should document
this.

-- 
Tomáš Mráz
No matter how far down the wrong road you've gone, turn back.
                                              Turkish proverb
[You'll know whether the road is wrong if you carefully listen to your
conscience.]





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux