Make use of user passphrase handler during genkey.
authorBen Kibbey <bjk@luxsci.net>
Tue, 14 Apr 2015 22:39:26 +0000 (18:39 -0400)
committerBen Kibbey <bjk@luxsci.net>
Sat, 15 Aug 2015 22:17:06 +0000 (18:17 -0400)
* src/genkey.c (genkey_start): set engine passphrase command handler.

--
This allows for inquiring a new passphrase during key generation rather
than requiring a pinentry. Needs a patch to gnupg to make use of
--command-fd with --gen-key.

src/genkey.c

index fd6685e..17009bd 100644 (file)
@@ -186,6 +186,14 @@ genkey_start (gpgme_ctx_t ctx, int synchronous, const char *parms,
 
   _gpgme_engine_set_status_handler (ctx->engine, genkey_status_handler, ctx);
 
+  if (ctx->passphrase_cb)
+    {
+      err = _gpgme_engine_set_command_handler
+        (ctx->engine, _gpgme_passphrase_command_handler, ctx, NULL);
+      if (err)
+        return err;
+    }
+
   return _gpgme_engine_op_genkey (ctx->engine, opd->key_parameter,
                                  ctx->use_armor, pubkey, seckey);
 }