diff --git a/NEWS b/NEWS index 05d14f11..f4c39098 100644 --- a/NEWS +++ b/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/doc/ChangeLog b/doc/ChangeLog index 3646472e..e1f36225 100644 --- a/doc/ChangeLog +++ b/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/doc/gpgme.texi b/doc/gpgme.texi index d66216ab..0d5435f9 100644 --- a/doc/gpgme.texi +++ b/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/src/ChangeLog b/src/ChangeLog index 9237bd6a..434c6802 100644 --- a/src/ChangeLog +++ b/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/src/engine-gpg.c b/src/engine-gpg.c index e4334d14..606b4d76 100644 --- a/src/engine-gpg.c +++ b/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/src/engine-gpgsm.c b/src/engine-gpgsm.c index bdd1ff92..49d36c12 100644 --- a/src/engine-gpgsm.c +++ b/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/src/gpgme.h.in b/src/gpgme.h.in index e42b3b89..fb2b7363 100644 --- a/src/gpgme.h.in +++ b/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;