aboutsummaryrefslogtreecommitdiffstats
path: root/sm/call-agent.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2002-02-18 20:47:29 +0000
committerWerner Koch <[email protected]>2002-02-18 20:47:29 +0000
commit5dac4711f9a70fd22abad2569521eac657893e85 (patch)
treedf737a8cbff65a15dfe5684a2c92fb7253ef0027 /sm/call-agent.c
parentSome experimental code - don't use it. (diff)
downloadgnupg-5dac4711f9a70fd22abad2569521eac657893e85.tar.gz
gnupg-5dac4711f9a70fd22abad2569521eac657893e85.zip
* certpath.c (gpgsm_validate_path): Ask the agent to add the
certificate into the trusted list. * call-agent.c (gpgsm_agent_marktrusted): New.
Diffstat (limited to 'sm/call-agent.c')
-rw-r--r--sm/call-agent.c38
1 files changed, 37 insertions, 1 deletions
diff --git a/sm/call-agent.c b/sm/call-agent.c
index 5b3b6d6d0..54e8facb1 100644
--- a/sm/call-agent.c
+++ b/sm/call-agent.c
@@ -461,8 +461,43 @@ gpgsm_agent_istrusted (KsbaCert cert)
rc = assuan_transact (agent_ctx, line, NULL, NULL, NULL, NULL);
return map_assuan_err (rc);
}
-
+/* Ask the agent to mark CERT as a trusted Root-CA one */
+int
+gpgsm_agent_marktrusted (KsbaCert cert)
+{
+ int rc;
+ char *fpr, *dn;
+ char line[ASSUAN_LINELENGTH];
+
+ rc = start_agent ();
+ if (rc)
+ return rc;
+
+ fpr = gpgsm_get_fingerprint_hexstring (cert, GCRY_MD_SHA1);
+ if (!fpr)
+ {
+ log_error ("error getting the fingerprint\n");
+ return seterr (General_Error);
+ }
+
+ dn = ksba_cert_get_issuer (cert, 0);
+ if (!dn)
+ {
+ xfree (fpr);
+ return seterr (General_Error);
+ }
+ snprintf (line, DIM(line)-1, "MARKTRUSTED %s S %s", fpr, dn);
+ line[DIM(line)-1] = 0;
+ ksba_free (dn);
+ xfree (fpr);
+
+ rc = assuan_transact (agent_ctx, line, NULL, NULL, NULL, NULL);
+ return map_assuan_err (rc);
+}
+
+
+
/* Ask the agent whether the a corresponding secret key is available
for the given keygrip */
int
@@ -484,3 +519,4 @@ gpgsm_agent_havekey (const char *hexkeygrip)
rc = assuan_transact (agent_ctx, line, NULL, NULL, NULL, NULL);
return map_assuan_err (rc);
}
+