summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2019-09-28 12:42:12 +0200
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2019-09-28 21:11:21 +0200
commita3ec822a005bc6446fda8cd263dfc2c0d66cfc8a (patch)
tree86c5aaa9a2c40c0f00dd41c449225ef265634bf7 /src
parent477d44b3a3afffd05b275b9d40e4e66c6b55d68c (diff)
downloadgnutls-a3ec822a005bc6446fda8cd263dfc2c0d66cfc8a.tar.gz
certtool: ensure that PKCS#8 file does not contain key description
Resolves: #840 Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
Diffstat (limited to 'src')
-rw-r--r--src/certtool-common.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/certtool-common.c b/src/certtool-common.c
index 66b81e5508..3fafa5977c 100644
--- a/src/certtool-common.c
+++ b/src/certtool-common.c
@@ -1382,13 +1382,13 @@ print_private_key(FILE *outfile, common_info_st * cinfo, gnutls_x509_privkey_t k
/* Only print private key parameters when an unencrypted
* format is used */
- if (cinfo->outtext)
- privkey_info_int(outfile, cinfo, key);
-
switch_to_pkcs8_when_needed(cinfo, key, gnutls_x509_privkey_get_pk_algorithm(key));
if (!cinfo->pkcs8) {
+ if (cinfo->outtext)
+ privkey_info_int(outfile, cinfo, key);
+
size = lbuffer_size;
ret = gnutls_x509_privkey_export(key, cinfo->outcert_format,
lbuffer, &size);
@@ -1404,6 +1404,9 @@ print_private_key(FILE *outfile, common_info_st * cinfo, gnutls_x509_privkey_t k
pass = get_password(cinfo, &flags, 0);
flags |= cipher_to_flags(cinfo->pkcs_cipher);
+ if (cinfo->outtext && (flags & GNUTLS_PKCS_PLAIN))
+ privkey_info_int(outfile, cinfo, key);
+
size = lbuffer_size;
ret =
gnutls_x509_privkey_export_pkcs8(key, cinfo->outcert_format,