From b2db9a01294b1c2f4e86bc362f01be913fc0b902 Mon Sep 17 00:00:00 2001 From: Marcus Brinkmann Date: Mon, 18 May 2009 17:38:31 +0000 Subject: [PATCH] doc/ 2009-05-18 Marcus Brinkmann * gpgme.texi (Encrypting a Plaintext): Document GPGME_ENCRYPT_NO_ENCRYPT_TO. src/ 2009-05-18 Marcus Brinkmann * gpgme.h.in (gpgme_encrypt_flags_t): Add GPGME_ENCRYPT_NO_ENCRYPT_TO. * engine-gpg.c (gpg_encrypt): Pass --no-encrypt-to to gpg if GPGME_ENCRYPT_NO_ENCRYPT_TO flag is set. --- trunk/NEWS | 4 ++++ trunk/doc/ChangeLog | 5 +++++ trunk/doc/gpgme.texi | 6 ++++++ trunk/src/ChangeLog | 7 +++++++ trunk/src/engine-gpg.c | 5 ++++- trunk/src/engine-gpgsm.c | 8 ++++++++ trunk/src/gpgme.h.in | 3 ++- 7 files changed, 36 insertions(+), 2 deletions(-) diff --git a/trunk/NEWS b/trunk/NEWS index 05d14f1..f4c3909 100644 --- a/trunk/NEWS +++ b/trunk/NEWS @@ -1,6 +1,9 @@ Noteworthy changes in version 1.1.9 ------------------------------------------------ + * New encryption flag GPGME_ENCRYPT_NO_ENCRYPT_TO to disable default + recipients. + * Interface changes relative to the 1.1.7 release: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ GPGME_KEYLIST_MODE_EPHEMERAL NEW. @@ -12,6 +15,7 @@ Noteworthy changes in version 1.1.9 gpgme_op_assuan_transact NEW. gpgme_op_assuan_result NEW. gpgme_subkey_t EXTENDED: New fields is_cardkey, card_number. + GPGME_ENCRYPT_NO_ENCRYPT_TO NEW. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/trunk/doc/ChangeLog b/trunk/doc/ChangeLog index 3646472..e1f3622 100644 --- a/trunk/doc/ChangeLog +++ b/trunk/doc/ChangeLog @@ -1,3 +1,8 @@ +2009-05-18 Marcus Brinkmann + + * gpgme.texi (Encrypting a Plaintext): Document + GPGME_ENCRYPT_NO_ENCRYPT_TO. + 2009-05-05 Marcus Brinkmann * gpgme.texi (Engine Information): Replace path by file_name. diff --git a/trunk/doc/gpgme.texi b/trunk/doc/gpgme.texi index d66216a..0d5435f 100644 --- a/trunk/doc/gpgme.texi +++ b/trunk/doc/gpgme.texi @@ -4723,6 +4723,12 @@ The @code{GPGME_ENCRYPT_ALWAYS_TRUST} symbol specifies that all the recipients in @var{recp} should be trusted, even if the keys do not have a high enough validity in the keyring. This flag should be used with care; in general it is not a good idea to use any untrusted keys. + +@item GPGME_ENCRYPT_NO_ENCRYPT_TO +The @code{GPGME_ENCRYPT_NO_ENCRYPT_TO} symbol specifies that no +default or hidden default recipients as configured in the crypto +backend should be included. This can be useful for managing different +user profiles. @end table If @code{GPG_ERR_UNUSABLE_PUBKEY} is returned, some recipients in diff --git a/trunk/src/ChangeLog b/trunk/src/ChangeLog index 9237bd6..434c680 100644 --- a/trunk/src/ChangeLog +++ b/trunk/src/ChangeLog @@ -1,3 +1,10 @@ +2009-05-18 Marcus Brinkmann + + * gpgme.h.in (gpgme_encrypt_flags_t): Add + GPGME_ENCRYPT_NO_ENCRYPT_TO. + * engine-gpg.c (gpg_encrypt): Pass --no-encrypt-to to gpg if + GPGME_ENCRYPT_NO_ENCRYPT_TO flag is set. + 2009-05-14 Werner Koch * gpgme.h.in (gpgme_status_code_t): Explicitly initialize for diff --git a/trunk/src/engine-gpg.c b/trunk/src/engine-gpg.c index e4334d1..606b4d7 100644 --- a/trunk/src/engine-gpg.c +++ b/trunk/src/engine-gpg.c @@ -1611,9 +1611,12 @@ gpg_encrypt (void *engine, gpgme_key_t recp[], gpgme_encrypt_flags_t flags, { /* If we know that all recipients are valid (full or ultimate trust) we can suppress further checks. */ - if (!err && !symmetric && (flags & GPGME_ENCRYPT_ALWAYS_TRUST)) + if (!err && (flags & GPGME_ENCRYPT_ALWAYS_TRUST)) err = add_arg (gpg, "--always-trust"); + if (!err && (flags & GPGME_ENCRYPT_NO_ENCRYPT_TO)) + err = add_arg (gpg, "--no-encrypt-to"); + if (!err) err = append_args_from_recipients (gpg, recp); } diff --git a/trunk/src/engine-gpgsm.c b/trunk/src/engine-gpgsm.c index bdd1ff9..49d36c1 100644 --- a/trunk/src/engine-gpgsm.c +++ b/trunk/src/engine-gpgsm.c @@ -1349,6 +1349,14 @@ gpgsm_encrypt (void *engine, gpgme_key_t recp[], gpgme_encrypt_flags_t flags, if (!recp) return gpg_error (GPG_ERR_NOT_IMPLEMENTED); + if (flags & GPGME_ENCRYPT_NO_ENCRYPT_TO) + { + err = gpgsm_assuan_simple_command (gpgsm->assuan_ctx, + "OPTION no-encrypt-to", NULL, NULL); + if (err) + return err; + } + gpgsm->input_cb.data = plain; err = gpgsm_set_fd (gpgsm, INPUT_FD, map_data_enc (gpgsm->input_cb.data)); if (err) diff --git a/trunk/src/gpgme.h.in b/trunk/src/gpgme.h.in index e42b3b8..fb2b736 100644 --- a/trunk/src/gpgme.h.in +++ b/trunk/src/gpgme.h.in @@ -1168,7 +1168,8 @@ gpgme_encrypt_result_t gpgme_op_encrypt_result (gpgme_ctx_t ctx); /* The valid encryption flags. */ typedef enum { - GPGME_ENCRYPT_ALWAYS_TRUST = 1 + GPGME_ENCRYPT_ALWAYS_TRUST = 1, + GPGME_ENCRYPT_NO_ENCRYPT_TO = 2 } gpgme_encrypt_flags_t; -- 2.26.2