]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
certtool: print a PKCS #8 key even if it is not encrypted.
authorNikos Mavrogiannopoulos <nmav@crystal.(none)>
Wed, 22 Oct 2008 19:06:21 +0000 (22:06 +0300)
committerNikos Mavrogiannopoulos <nmav@crystal.(none)>
Wed, 22 Oct 2008 19:06:21 +0000 (22:06 +0300)
NEWS
src/certtool.c

diff --git a/NEWS b/NEWS
index 6e98628f59dcb0dfeb22e9f628f5096318f29ac5..d3276da2bae8cd226dde7214c569032a11f9c183 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,8 @@ See the end for copying conditions.
 
 * Version 2.7.1 (unreleased)
 
+** certtool: print a PKCS #8 key even if it is not encrypted.
+
 ** API and ABI modifications:
 No changes since last version.
 
index 4c01a9cbc85f7e814e95041163ed18e1dea0a0b7..ccafb1ab85130719478d77ee3a779c86490deaa7 100644 (file)
@@ -1478,13 +1478,20 @@ privkey_info (void)
   /* If we failed to import the certificate previously try PKCS #8 */
   if (info.pkcs8 || ret == GNUTLS_E_BASE64_UNEXPECTED_HEADER_ERROR)
     {
-      if (info.pass)
-       pass = info.pass;
-      else
-       pass = get_pass ();
+      /* first try to import the key without asking any password */
       ret =
        gnutls_x509_privkey_import_pkcs8 (key, &pem, info.incert_format,
+                                         NULL, GNUTLS_PKCS_PLAIN);
+      if (ret < 0) 
+        {
+         if (info.pass)
+           pass = info.pass;
+         else
+           pass = get_pass ();
+          ret = 
+           gnutls_x509_privkey_import_pkcs8 (key, &pem, info.incert_format, 
                                          pass, 0);
+       }
     }
   if (ret < 0)
     error (EXIT_FAILURE, 0, "Import error: %s", gnutls_strerror (ret));