summaryrefslogtreecommitdiffstats
path: root/scd/card.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2002-08-16 16:23:40 +0200
committerWerner Koch <wk@gnupg.org>2002-08-16 16:23:40 +0200
commit8ed2348ae537dcab4ba1413031e6bd834ecc30d4 (patch)
tree4906addc325bb0465c6d0c92ce72b61dcac7da13 /scd/card.c
parentRenamed some configure flags. (diff)
downloadgnupg2-8ed2348ae537dcab4ba1413031e6bd834ecc30d4.tar.xz
gnupg2-8ed2348ae537dcab4ba1413031e6bd834ecc30d4.zip
* scdaemon.c: Include i18n.h.
* card-common.h (struct p15_private_s): Forward declaration. Add it to card_ctx_s. * card.c (card_close): Make sure private data is released. (card_enum_certs): New. * card-p15.c (p15_release_private_data): New. (init_private_data): New to work around an OpenSC weirdness. (p15_enum_keypairs): Do an OpenSC get_objects only once. (p15_enum_certs): New. (card_p15_bind): Bind new function. * command.c (cmd_learn): Return information about the certificates.
Diffstat (limited to 'scd/card.c')
-rw-r--r--scd/card.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/scd/card.c b/scd/card.c
index 34812b8a1..9e0f060e5 100644
--- a/scd/card.c
+++ b/scd/card.c
@@ -428,6 +428,39 @@ card_enum_keypairs (CARD card, int idx,
}
+/* Enumerate all trusted certificates available on the card, return
+ their ID in CERT and the type in CERTTYPE. Types of certificates
+ are:
+ 0 := Unknown
+ 100 := Regular X.509 cert
+ 101 := Trusted X.509 cert
+ 102 := Useful X.509 cert
+ */
+int
+card_enum_certs (CARD card, int idx, char **certid, int *certtype)
+{
+ int rc;
+
+ if (certid)
+ *certid = NULL;
+
+ if (!card)
+ return GNUPG_Invalid_Value;
+ if (idx < 0)
+ return GNUPG_Invalid_Index;
+ if (!card->fnc.initialized)
+ return GNUPG_Card_Not_Initialized;
+ if (!card->fnc.enum_certs)
+ return GNUPG_Unsupported_Operation;
+ rc = card->fnc.enum_certs (card, idx, certid, certtype);
+ if (opt.verbose)
+ log_info ("card operation enum_certs result: %s\n",
+ gnupg_strerror (rc));
+ return rc;
+}
+
+
+
/* Read the certificate identified by CERTIDSTR which is the
hexadecimal encoded ID of the certificate, prefixed with the string
"3F005015.". The certificate is return in DER encoded form in CERT