Accessing bignums of a RSA key with OpenSSL 3.0?

Dr Paul Dale pauli at openssl.org
Fri Jul 30 13:07:18 UTC 2021


Try: include/openssl/core_names.h
The names are "n", "e" and "d" in this case.


Pauli


On 30/7/21 10:57 pm, Olivier Mascia via openssl-users wrote:
> Dear all,
>
> Testing migration to OpenSSL 3.0.
> Got to update some code building a JWK (in relation to ACME LetsEncrypt protocols).
>
> Having an EVP_PKEY which happens to be a RSA key, I proceeded this way (1.1.1) to extract the bignums needed for inclusion into the JWK:
>
> 	// Access the numerical components of the certificate RSA keys.
> 	BIGNUM* n;
> 	BIGNUM* e;
> 	BIGNUM* d;
> 	RSA_get0_key(cert.RSAkey(), &n, &e, &d);
>
> ( my cert.RSAkey() returned RSA* from my embedded EVP_PKEY* through EVP_PKEY_get0_RSA() )
>
> I understand I should now start straight from the EVP_PKEY and use :
>
> 	EVP_PKEY_get_bn_param(cert.key(), "name-n?", &n);
> 	EVP_PKEY_get_bn_param(cert.key(), "name-e?", &e);
> 	EVP_PKEY_get_bn_param(cert.key(), "name-d?", &d);
>
> ( cert.key() returns EVP_KEY* )
>
> The question is: where can I find the proper names for these bignums out of a RSA key?
>
> __
> Best Regards, Meilleures salutations, Met vriendelijke groeten, Mit freundlichen Grüßen,
> Olivier Mascia
>
>



More information about the openssl-users mailing list