diff options
author | 2019-11-20 10:46:17 +0000 | |
---|---|---|
committer | 2019-11-20 10:46:17 +0000 | |
commit | 0cee8b3541e08b874f6c8742283849caeba44e6f (patch) | |
tree | 397bc573ff4deca913ffed503c90c8fb930cdd0d /lib/libcrypto | |
parent | Sync documentation fixes from upstream: (diff) | |
download | wireguard-openbsd-0cee8b3541e08b874f6c8742283849caeba44e6f.tar.xz wireguard-openbsd-0cee8b3541e08b874f6c8742283849caeba44e6f.zip |
Fix rsa key output format
This fixes openssl(1) rsa -text output format
ok tb@
Diffstat (limited to 'lib/libcrypto')
-rw-r--r-- | lib/libcrypto/rsa/rsa_ameth.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/lib/libcrypto/rsa/rsa_ameth.c b/lib/libcrypto/rsa/rsa_ameth.c index 255ccb4d131..d373d7c1327 100644 --- a/lib/libcrypto/rsa/rsa_ameth.c +++ b/lib/libcrypto/rsa/rsa_ameth.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rsa_ameth.c,v 1.23 2019/11/02 14:35:48 jsing Exp $ */ +/* $OpenBSD: rsa_ameth.c,v 1.24 2019/11/20 10:46:17 inoguchi Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2006. */ @@ -449,10 +449,17 @@ pkey_rsa_print(BIO *bp, const EVP_PKEY *pkey, int off, int priv) if (BIO_printf(bp, "%s ", pkey_is_pss(pkey) ? "RSA-PSS" : "RSA") <= 0) goto err; - if (BIO_printf(bp, "Public-Key: (%d bit)\n", mod_len) <= 0) - goto err; - str = "Modulus:"; - s = "Exponent:"; + if (priv && x->d != NULL) { + if (BIO_printf(bp, "Private-Key: (%d bit)\n", mod_len) <= 0) + goto err; + str = "modulus:"; + s = "publicExponent:"; + } else { + if (BIO_printf(bp, "Public-Key: (%d bit)\n", mod_len) <= 0) + goto err; + str = "Modulus:"; + s = "Exponent:"; + } if (!ASN1_bn_print(bp, str, x->n, m, off)) goto err; if (!ASN1_bn_print(bp, s, x->e, m, off)) |