Accessing bignums of a RSA key with OpenSSL 3.0?

Olivier Mascia om at integral.be
Fri Jul 30 12:57:34 UTC 2021


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