]> git.ipfire.org Git - thirdparty/openssl.git/blobdiff - apps/x509.c
Deprecate RSA harder
[thirdparty/openssl.git] / apps / x509.c
index 0d0d93edc0a61798e76f31c536aec50690b18f82..ad627f4558dd947ad7c617e76be6d11e1eddd45e 100644 (file)
@@ -757,10 +757,13 @@ int x509_main(int argc, char **argv)
                 }
                 BIO_printf(out, "Modulus=");
 #ifndef OPENSSL_NO_RSA
-                if (EVP_PKEY_id(pkey) == EVP_PKEY_RSA) {
-                    const BIGNUM *n;
-                    RSA_get0_key(EVP_PKEY_get0_RSA(pkey), &n, NULL, NULL);
+                if (EVP_PKEY_is_a(pkey, "RSA")) {
+                    BIGNUM *n;
+
+                    /* Every RSA key has an 'n' */
+                    EVP_PKEY_get_bn_param(pkey, "n", &n);
                     BN_print(out, n);
+                    BN_free(n);
                 } else
 #endif
 #ifndef OPENSSL_NO_DSA