]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
certtool --outder option now works for private keys as well.
authorNikos Mavrogiannopoulos <nmav@gnutls.org>
Sun, 8 Jan 2012 12:21:23 +0000 (13:21 +0100)
committerNikos Mavrogiannopoulos <nmav@gnutls.org>
Sun, 8 Jan 2012 12:21:45 +0000 (13:21 +0100)
NEWS
src/certtool.c

diff --git a/NEWS b/NEWS
index df33d1b2df161dbc3296bba7102568611f3fc40f..167e6b15c046648a4d57afdff9ea741fafb0713a 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,9 @@ See the end for copying conditions.
 
 * Version 3.0.12 (unreleased)
 
+** certtool: --outder option now works for private
+keys as well.
+
 ** libgnutls: Corrected memory leak in DH parameter
 generation.
 
index 11de1f995e9f90fb764ecb365fc3117c68106522..558bbfaf26d16c19f7b0510f7a81549bd98a8149 100644 (file)
@@ -275,7 +275,8 @@ print_private_key (gnutls_x509_privkey_t key)
   if (!key)
     return;
 
-  privkey_info_int(key);
+  if (info.outcert_format == GNUTLS_X509_FMT_PEM)
+    privkey_info_int(key);
 
   if (!info.pkcs8)
     {
@@ -1788,7 +1789,8 @@ privkey_info (void)
   if (ret < 0)
     error (EXIT_FAILURE, 0, "import error: %s", gnutls_strerror (ret));
 
-  privkey_info_int (key);
+  if (info.outcert_format == GNUTLS_X509_FMT_PEM)
+    privkey_info_int (key);
 
   ret = gnutls_x509_privkey_verify_params (key);
   if (ret < 0)
@@ -1802,11 +1804,11 @@ privkey_info (void)
     }
 
   size = buffer_size;
-  ret = gnutls_x509_privkey_export (key, GNUTLS_X509_FMT_PEM, buffer, &size);
+  ret = gnutls_x509_privkey_export (key, info.outcert_format, buffer, &size);
   if (ret < 0)
     error (EXIT_FAILURE, 0, "export error: %s", gnutls_strerror (ret));
 
-  fprintf (outfile, "\n%s\n", buffer);
+  fwrite (buffer, 1, size, outfile);
 
   gnutls_x509_privkey_deinit (key);
 }