560
562
/* Ask the agent whether the certificate is in the list of trusted
561
keys. ROOTCA_FLAGS is guaranteed to be cleared on error. */
563
keys. The certificate is either specified by the CERT object or by
564
the fingerprint HEXFPR. ROOTCA_FLAGS is guaranteed to be cleared
563
gpgsm_agent_istrusted (ctrl_t ctrl, ksba_cert_t cert,
567
gpgsm_agent_istrusted (ctrl_t ctrl, ksba_cert_t cert, const char *hexfpr,
564
568
struct rootca_flags_s *rootca_flags)
568
571
char line[ASSUAN_LINELENGTH];
570
573
memset (rootca_flags, 0, sizeof *rootca_flags);
576
return gpg_error (GPG_ERR_INV_ARG);
572
578
rc = start_agent (ctrl);
576
fpr = gpgsm_get_fingerprint_hexstring (cert, GCRY_MD_SHA1);
579
log_error ("error getting the fingerprint\n");
580
return gpg_error (GPG_ERR_GENERAL);
584
snprintf (line, DIM(line)-1, "ISTRUSTED %s", hexfpr);
585
line[DIM(line)-1] = 0;
583
snprintf (line, DIM(line)-1, "ISTRUSTED %s", fpr);
584
line[DIM(line)-1] = 0;
591
fpr = gpgsm_get_fingerprint_hexstring (cert, GCRY_MD_SHA1);
594
log_error ("error getting the fingerprint\n");
595
return gpg_error (GPG_ERR_GENERAL);
598
snprintf (line, DIM(line)-1, "ISTRUSTED %s", fpr);
599
line[DIM(line)-1] = 0;
587
603
rc = assuan_transact (agent_ctx, line, NULL, NULL, NULL, NULL,
588
604
istrusted_status_cb, rootca_flags);
802
818
default_inq_cb, ctrl, NULL, NULL);
824
/* Return 0 if the agent is alive. This is useful to make sure that
825
an agent has been started. */
827
gpgsm_agent_send_nop (ctrl_t ctrl)
831
rc = start_agent (ctrl);
833
rc = assuan_transact (agent_ctx, "NOP",
834
NULL, NULL, NULL, NULL, NULL, NULL);