req, x509: Allow printing modulus of RSA-PSS keys
authorTomas Mraz <tomas@openssl.org>
Fri, 25 Mar 2022 14:13:16 +0000 (15:13 +0100)
committerTomas Mraz <tomas@openssl.org>
Fri, 1 Apr 2022 07:37:50 +0000 (09:37 +0200)
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17990)

(cherry picked from commit e4cdcb8bc44250aa4e0893dc4a7d64668f0fb949)

apps/req.c
apps/x509.c

index 71a5ab20cacda4382597b6bb1b3f1fa5415317db..23757044ab7f467824d0e32bc8095ea93852e606 100644 (file)
@@ -992,7 +992,7 @@ int req_main(int argc, char **argv)
             goto end;
         }
         fprintf(stdout, "Modulus=");
-        if (EVP_PKEY_is_a(tpubkey, "RSA")) {
+        if (EVP_PKEY_is_a(tpubkey, "RSA") || EVP_PKEY_is_a(tpubkey, "RSA-PSS")) {
             BIGNUM *n = NULL;
 
             if (!EVP_PKEY_get_bn_param(tpubkey, "n", &n))
index f09f1d1b3ba96440a827159bbf0962e4ffba71d4..2b9a0b6cb40884b3a8d95218b7e6e493cdd75758 100644 (file)
@@ -954,7 +954,7 @@ int x509_main(int argc, char **argv)
                 purpose_print(out, x, X509_PURPOSE_get0(j));
         } else if (i == modulus) {
             BIO_printf(out, "Modulus=");
-            if (EVP_PKEY_is_a(pkey, "RSA")) {
+            if (EVP_PKEY_is_a(pkey, "RSA") || EVP_PKEY_is_a(pkey, "RSA-PSS")) {
                 BIGNUM *n = NULL;
 
                 /* Every RSA key has an 'n' */