gpgme-tool: Allow for symmetric encryption.
authorWerner Koch <wk@gnupg.org>
Wed, 22 May 2013 08:50:12 +0000 (09:50 +0100)
committerWerner Koch <wk@gnupg.org>
Wed, 22 May 2013 14:20:14 +0000 (16:20 +0200)
* src/gpgme-tool.c (gt_sign_encrypt): Pass NULL for recp if no
recipients are given.

src/gpgme-tool.c

index bce52b8..0ebabab 100644 (file)
@@ -1911,11 +1911,14 @@ gt_sign_encrypt (gpgme_tool_t gt, gpgme_encrypt_flags_t flags,
                 gpgme_data_t plain, gpgme_data_t cipher, int sign)
 {
   gpg_error_t err;
+  gpgme_key_t *recp;
+
+  recp = gt->recipients_nr? gt->recipients : NULL;
 
   if (sign)
-    err = gpgme_op_encrypt_sign (gt->ctx, gt->recipients, flags, plain, cipher);
+    err = gpgme_op_encrypt_sign (gt->ctx, recp, flags, plain, cipher);
   else
-    err = gpgme_op_encrypt (gt->ctx, gt->recipients, flags, plain, cipher);
+    err = gpgme_op_encrypt (gt->ctx, recp, flags, plain, cipher);
 
   gt_recipients_clear (gt);