51
51
ctx = calloc (1, sizeof *ctx);
53
53
return gpg_error_from_errno (errno);
55
_gpgme_engine_info_copy (&ctx->engine_info);
56
if (!ctx->engine_info)
59
return gpg_error_from_errno (errno);
54
62
ctx->keylist_mode = GPGME_KEYLIST_MODE_LOCAL;
55
ctx->include_certs = 1;
63
ctx->include_certs = GPGME_INCLUDE_CERTS_DEFAULT;
56
64
ctx->protocol = GPGME_PROTOCOL_OpenPGP;
57
65
_gpgme_fd_table_init (&ctx->fdt);
213
224
/* Set the number of certifications to include in an S/MIME message.
214
The default is 1 (only the cert of the sender). -1 means all
215
certs, and -2 means all certs except the root cert. */
225
The default is GPGME_INCLUDE_CERTS_DEFAULT. -1 means all certs,
226
and -2 means all certs except the root cert. */
217
228
gpgme_set_include_certs (gpgme_ctx_t ctx, int nr_of_certs)
219
if (nr_of_certs < -2)
230
if (nr_of_certs == GPGME_INCLUDE_CERTS_DEFAULT)
231
ctx->include_certs = GPGME_INCLUDE_CERTS_DEFAULT;
232
else if (nr_of_certs < -2)
220
233
ctx->include_certs = -2;
222
235
ctx->include_certs = nr_of_certs;
388
402
UNLOCK (def_lc_lock);
404
#endif /*!HAVE_W32_SYSTEM*/
410
/* Get the information about the configured engines. A pointer to the
411
first engine in the statically allocated linked list is returned.
412
The returned data is valid until the next gpgme_ctx_set_engine_info. */
414
gpgme_ctx_get_engine_info (gpgme_ctx_t ctx)
416
return ctx->engine_info;
420
/* Set the engine info for the context CTX, protocol PROTO, to the
421
file name FILE_NAME and the home directory HOME_DIR. */
423
gpgme_ctx_set_engine_info (gpgme_ctx_t ctx, gpgme_protocol_t proto,
424
const char *file_name, const char *home_dir)
426
/* FIXME: Make sure to reset the context if we are running in daemon
428
return _gpgme_set_engine_info (ctx->engine_info, proto,
429
file_name, home_dir);
433
/* Clear all notation data from the context. */
435
gpgme_sig_notation_clear (gpgme_ctx_t ctx)
437
gpgme_sig_notation_t notation;
442
notation = ctx->sig_notations;
445
gpgme_sig_notation_t next_notation = notation->next;
446
_gpgme_sig_notation_free (notation);
447
notation = next_notation;
452
/* Add the human-readable notation data with name NAME and value VALUE
453
to the context CTX, using the flags FLAGS. If NAME is NULL, then
454
VALUE should be a policy URL. The flag
455
GPGME_SIG_NOTATION_HUMAN_READABLE is forced to be true for notation
456
data, and false for policy URLs. */
458
gpgme_sig_notation_add (gpgme_ctx_t ctx, const char *name,
459
const char *value, gpgme_sig_notation_flags_t flags)
462
gpgme_sig_notation_t notation;
463
gpgme_sig_notation_t *lastp;
466
gpg_error (GPG_ERR_INV_VALUE);
469
flags |= GPGME_SIG_NOTATION_HUMAN_READABLE;
471
flags &= ~GPGME_SIG_NOTATION_HUMAN_READABLE;
473
err = _gpgme_sig_notation_create (¬ation, name, name ? strlen (name) : 0,
474
value, value ? strlen (value) : 0, flags);
478
lastp = &ctx->sig_notations;
480
lastp = &(*lastp)->next;
487
/* Get the sig notations for this context. */
489
gpgme_sig_notation_get (gpgme_ctx_t ctx)
494
return ctx->sig_notations;
395
499
gpgme_pubkey_algo_name (gpgme_pubkey_algo_t algo)