openssl 3.0.0 get ECC public key modulus from EVP_PKEY

Ken Goldman kgoldman at us.ibm.com
Tue Oct 12 22:37:45 UTC 2021


In pre-3.0.0, I used this, omitting the error checking, malloc, ...

	ecPoint = EC_KEY_get0_public_key(ecKey);
	ecGroup = EC_KEY_get0_group(ecKey);
	EC_POINT_point2oct(ecGroup, ecPoint,
			   POINT_CONVERSION_UNCOMPRESSED,
			   *modulusBin, *modulusBytes, NULL);

In 3.0.0, I tried this, expecting to get a BIGNUM and then convert

	    irc = EVP_PKEY_get_bn_param(eccKey, OSSL_PKEY_PARAM_PUB_KEY, (BIGNUM **)pub);

It returns 0.

What's the correct way to get the uncompressed ECC public key?



More information about the openssl-users mailing list