diff options
author | inoguchi <> | 2019-11-20 10:46:17 +0000 |
---|---|---|
committer | inoguchi <> | 2019-11-20 10:46:17 +0000 |
commit | 4af85af128274707eff411ecefdb6180a9275e7d (patch) | |
tree | d1320d26152e83898750daf29653a45c6d375d86 /src/lib | |
parent | 1f1014ae28eeeeef92b04907f91fda940406edad (diff) | |
download | openbsd-4af85af128274707eff411ecefdb6180a9275e7d.tar.gz openbsd-4af85af128274707eff411ecefdb6180a9275e7d.tar.bz2 openbsd-4af85af128274707eff411ecefdb6180a9275e7d.zip |
Fix rsa key output format
This fixes openssl(1) rsa -text output format
ok tb@
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/libcrypto/rsa/rsa_ameth.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/lib/libcrypto/rsa/rsa_ameth.c b/src/lib/libcrypto/rsa/rsa_ameth.c index 255ccb4d13..d373d7c132 100644 --- a/src/lib/libcrypto/rsa/rsa_ameth.c +++ b/src/lib/libcrypto/rsa/rsa_ameth.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: rsa_ameth.c,v 1.23 2019/11/02 14:35:48 jsing Exp $ */ | 1 | /* $OpenBSD: rsa_ameth.c,v 1.24 2019/11/20 10:46:17 inoguchi Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project 2006. | 3 | * project 2006. |
4 | */ | 4 | */ |
@@ -449,10 +449,17 @@ pkey_rsa_print(BIO *bp, const EVP_PKEY *pkey, int off, int priv) | |||
449 | if (BIO_printf(bp, "%s ", pkey_is_pss(pkey) ? "RSA-PSS" : "RSA") <= 0) | 449 | if (BIO_printf(bp, "%s ", pkey_is_pss(pkey) ? "RSA-PSS" : "RSA") <= 0) |
450 | goto err; | 450 | goto err; |
451 | 451 | ||
452 | if (BIO_printf(bp, "Public-Key: (%d bit)\n", mod_len) <= 0) | 452 | if (priv && x->d != NULL) { |
453 | goto err; | 453 | if (BIO_printf(bp, "Private-Key: (%d bit)\n", mod_len) <= 0) |
454 | str = "Modulus:"; | 454 | goto err; |
455 | s = "Exponent:"; | 455 | str = "modulus:"; |
456 | s = "publicExponent:"; | ||
457 | } else { | ||
458 | if (BIO_printf(bp, "Public-Key: (%d bit)\n", mod_len) <= 0) | ||
459 | goto err; | ||
460 | str = "Modulus:"; | ||
461 | s = "Exponent:"; | ||
462 | } | ||
456 | if (!ASN1_bn_print(bp, str, x->n, m, off)) | 463 | if (!ASN1_bn_print(bp, str, x->n, m, off)) |
457 | goto err; | 464 | goto err; |
458 | if (!ASN1_bn_print(bp, s, x->e, m, off)) | 465 | if (!ASN1_bn_print(bp, s, x->e, m, off)) |