[PATCH 8/8] g10: export cleartext keys as cleartext

Daniel Kahn Gillmor dkg at fifthhorseman.net
Sat May 21 01:41:11 CEST 2016


* g10/export.c (do_export_stream): if a key is stored by the agent in
  cleartext, then try to export it as cleartext.

With this change, tests/openpgp/export-cleartext.test passes.
---
 g10/export.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/g10/export.c b/g10/export.c
index 54c72a2..ebc1edd 100644
--- a/g10/export.c
+++ b/g10/export.c
@@ -1141,6 +1141,7 @@ do_export_stream (ctrl_t ctrl, iobuf_t out, strlist_t users, int secret,
   gcry_cipher_hd_t cipherhd = NULL;
   char *cache_nonce = NULL;
   struct export_stats_s dummystats;
+  int cleartext = 0;
 
   if (!stats)
     stats = &dummystats;
@@ -1445,7 +1446,7 @@ do_export_stream (ctrl_t ctrl, iobuf_t out, strlist_t users, int secret,
                   serialno = NULL;
                 }
               else
-                err = agent_get_keyinfo (ctrl, hexgrip, &serialno, NULL);
+                err = agent_get_keyinfo (ctrl, hexgrip, &serialno, &cleartext);
 
               if ((!err && serialno)
                   && secret == 2 && node->pkt->pkttype == PKT_PUBLIC_KEY)
@@ -1494,7 +1495,7 @@ do_export_stream (ctrl_t ctrl, iobuf_t out, strlist_t users, int secret,
               else if (!err)
                 {
                   err = receive_seckey_from_agent (ctrl, cipherhd,
-                                                   0, &cache_nonce,
+                                                   cleartext, &cache_nonce,
                                                    hexgrip, pk);
                   if (err)
                     {
-- 
2.8.1




More information about the Gnupg-devel mailing list