]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
certtool: fix DER export with --p7-info
authorNikos Mavrogiannopoulos <nmav@redhat.com>
Tue, 6 Jun 2017 07:49:09 +0000 (09:49 +0200)
committerNikos Mavrogiannopoulos <nmav@redhat.com>
Tue, 6 Jun 2017 08:12:16 +0000 (10:12 +0200)
Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
src/certtool.c

index 514dd381fa2e6b45a699010aa6b16fe04f7dd3f2..1eb4f9b808343960094dab9be59b2c18530d57ef 100644 (file)
@@ -3841,15 +3841,17 @@ void pkcs7_info(common_info_st *cinfo, unsigned display_data)
                        app_exit(1);
                }
        } else {
-               ret = gnutls_pkcs7_print(pkcs7, GNUTLS_CRT_PRINT_FULL, &str);
-               if (ret < 0) {
-                       fprintf(stderr, "printing error: %s\n",
-                               gnutls_strerror(ret));
-                       app_exit(1);
-               }
+               if (outcert_format == GNUTLS_X509_FMT_PEM) {
+                       ret = gnutls_pkcs7_print(pkcs7, GNUTLS_CRT_PRINT_FULL, &str);
+                       if (ret < 0) {
+                               fprintf(stderr, "printing error: %s\n",
+                                       gnutls_strerror(ret));
+                               app_exit(1);
+                       }
 
-               fprintf(outfile, "%s", str.data);
-               gnutls_free(str.data);
+                       fprintf(outfile, "%s", str.data);
+                       gnutls_free(str.data);
+               }
 
                size = lbuffer_size;
                ret =