diff --git a/doc/gpgme.texi b/doc/gpgme.texi index 330b167e..3975a971 100644 --- a/doc/gpgme.texi +++ b/doc/gpgme.texi @@ -6180,8 +6180,16 @@ This is an extended version of @code{gpgme_op_encrypt} with @var{recpstring} is not NULL, the latter is expected to be a linefeed delimited string with the set of key specifications. In contrast to @var{recp} the keys are given directly as strings and there is no need -to first create key objects. The keys are passed verbatim to the -backend engine. +to first create key objects. Leading and trailing white space is +remove from each line in @var{recpstring}. The keys are then passed +verbatim to the backend engine. + +For the OpenPGP backend two special keywords are supported to modify +the operation: If the keyword "--hidden" is given as a recipient, it +is skipped but will trun all following key specifications to be hidden +recipients. If the keyword "--" is given as a recipient, it will be +skipped but no keywords will be detected in all following key +specifications. @end deftypefun diff --git a/src/engine-gpg.c b/src/engine-gpg.c index 90e3b89e..49a1c75e 100644 --- a/src/engine-gpg.c +++ b/src/engine-gpg.c @@ -1985,6 +1985,8 @@ append_args_from_recipients_string (engine_gpg_t gpg, { gpg_error_t err = 0; int any = 0; + int ignore = 0; + int hidden = 0; const char *s; int n; @@ -2005,10 +2007,14 @@ append_args_from_recipients_string (engine_gpg_t gpg, while (n && (string[n-1] == ' ' || string[n-1] == '\t')) n--; - /* Add arg if it is not empty. */ - if (n) + if (!ignore && n == 2 && !memcmp (string, "--", 2)) + ignore = 1; + else if (!ignore && n == 8 && !memcmp (string, "--hidden", 8)) + hidden = 1; + else if (n) { - err = add_arg (gpg, "-r"); + /* Add arg if it is not empty. */ + err = add_arg (gpg, hidden? "-R":"-r"); if (!err) err = add_arg_recipient_string (gpg, flags, string, n); if (!err)