209 |
{ |
{ |
210 |
gpgme_error_t rc = 0; |
gpgme_error_t rc = 0; |
211 |
gpgme_key_t key; |
gpgme_key_t key; |
212 |
|
int i; |
213 |
|
|
214 |
fail_on_pending_request (ctx); |
fail_on_pending_request (ctx); |
215 |
ctx->pending = 1; |
ctx->pending = 1; |
233 |
} |
} |
234 |
|
|
235 |
_gpgme_gpg_add_arg (ctx->gpg, "--yes"); |
_gpgme_gpg_add_arg (ctx->gpg, "--yes"); |
236 |
key = gpgme_signers_enum (ctx, 0); |
|
237 |
if (key) |
for (i=0; (key = gpgme_signers_enum (ctx, i)); i++) { |
|
{ |
|
238 |
const char * s; |
const char * s; |
239 |
s = gpgme_key_get_string_attr (key, GPGME_ATTR_KEYID, NULL, 0); |
s = gpgme_key_get_string_attr (key, GPGME_ATTR_KEYID, NULL, 0); |
240 |
if (!s) |
if (!s) |
241 |
return mk_error (Invalid_Value); |
continue; |
242 |
_gpgme_gpg_add_arg (ctx->gpg, "-u"); |
_gpgme_gpg_add_arg (ctx->gpg, "-u"); |
243 |
_gpgme_gpg_add_arg_concat (ctx->gpg, s, "!"); |
_gpgme_gpg_add_arg_concat (ctx->gpg, s, "!"); |
244 |
if (signenc) |
if (signenc) { |
|
{ |
|
245 |
_gpgme_gpg_add_arg (ctx->gpg, "--encrypt-to"); |
_gpgme_gpg_add_arg (ctx->gpg, "--encrypt-to"); |
246 |
_gpgme_gpg_add_arg (ctx->gpg, s); |
_gpgme_gpg_add_arg (ctx->gpg, s); |
247 |
} |
} |
248 |
|
gpgme_key_unref (key); |
249 |
} |
} |
250 |
if( ctx->use_armor ) |
if( ctx->use_armor ) |
251 |
_gpgme_gpg_add_arg( ctx->gpg, "--armor" ); |
_gpgme_gpg_add_arg( ctx->gpg, "--armor" ); |
299 |
|
|
300 |
|
|
301 |
static gpgme_error_t |
static gpgme_error_t |
302 |
sign_start( gpgme_ctx_t ctx, gpgme_data_t in, gpgme_data_t out, gpgme_sigmode_t mode ) |
sign_start (gpgme_ctx_t ctx, gpgme_data_t in, gpgme_data_t out, gpgme_sigmode_t mode) |
303 |
{ |
{ |
|
int rc = 0; |
|
|
int i; |
|
304 |
gpgme_key_t key; |
gpgme_key_t key; |
305 |
|
int rc = 0; |
306 |
|
int i; |
307 |
|
|
308 |
fail_on_pending_request( ctx ); |
fail_on_pending_request( ctx ); |
309 |
ctx->pending = 1; |
ctx->pending = 1; |
346 |
if( ctx->use_textmode) |
if( ctx->use_textmode) |
347 |
_gpgme_gpg_add_arg (ctx->gpg, "--textmode"); |
_gpgme_gpg_add_arg (ctx->gpg, "--textmode"); |
348 |
} |
} |
349 |
for (i = 0; (key = gpgme_signers_enum (ctx, i)); i++) |
for (i = 0; (key = gpgme_signers_enum (ctx, i)); i++) { |
|
{ |
|
350 |
const char *s; |
const char *s; |
351 |
s = gpgme_key_get_string_attr( key, GPGME_ATTR_KEYID, NULL, 0); |
s = gpgme_key_get_string_attr (key, GPGME_ATTR_KEYID, NULL, 0); |
352 |
if (s) |
if (s) { |
|
{ |
|
353 |
_gpgme_gpg_add_arg (ctx->gpg, "-u"); |
_gpgme_gpg_add_arg (ctx->gpg, "-u"); |
354 |
_gpgme_gpg_add_arg_concat (ctx->gpg, s, "!"); |
_gpgme_gpg_add_arg_concat (ctx->gpg, s, "!"); |
355 |
} |
} |
461 |
|
|
462 |
|
|
463 |
gpgme_error_t |
gpgme_error_t |
464 |
gpgme_op_file_sign( gpgme_ctx_t ctx, gpgme_sigmode_t mode, |
gpgme_op_file_sign (gpgme_ctx_t ctx, gpgme_sigmode_t mode, |
465 |
const char * input, const char * output ) |
const char * input, const char * output) |
466 |
{ |
{ |
467 |
gpgme_error_t err; |
gpgme_error_t err; |
468 |
|
|
469 |
err = file_sign_start( ctx, 0, mode, NULL, input, output ); |
err = file_sign_start (ctx, 0, mode, NULL, input, output); |
470 |
if( !err ) { |
if (!err) { |
471 |
gpgme_wait( ctx, 1 ); |
gpgme_wait (ctx, 1); |
472 |
ctx->pending = 0; |
ctx->pending = 0; |
473 |
err = get_sign_result( ctx ); |
err = get_sign_result (ctx); |
474 |
} |
} |
475 |
return err; |
return err; |
476 |
} /* gpgme_file_sign */ |
} /* gpgme_file_sign */ |