diff options
author | Werner Koch <[email protected]> | 2002-08-16 14:23:40 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2002-08-16 14:23:40 +0000 |
commit | 8ed2348ae537dcab4ba1413031e6bd834ecc30d4 (patch) | |
tree | 4906addc325bb0465c6d0c92ce72b61dcac7da13 /scd/command.c | |
parent | Renamed some configure flags. (diff) | |
download | gnupg-8ed2348ae537dcab4ba1413031e6bd834ecc30d4.tar.gz gnupg-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 '')
-rw-r--r-- | scd/command.c | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/scd/command.c b/scd/command.c index 9e0ddc502..aa410a6ee 100644 --- a/scd/command.c +++ b/scd/command.c @@ -151,7 +151,17 @@ cmd_serialno (ASSUAN_CONTEXT ctx, char *line) S KEYPAIRINFO <hexstring_with_keygrip> <hexstring_with_id> If there is no certificate yet stored on the card a single "X" is - returned as the keygrip. + returned as the keygrip. In addition to the keypair info, information + about all certificates stored on the card is also returned: + + S CERTINFO <certtype> <hexstring_with_id> + + Where CERTINFO is a number indicating the type of certificate: + 0 := Unknown + 100 := Regular X.509 cert + 101 := Trusted X.509 cert + 102 := Useful X.509 cert + */ static int @@ -209,6 +219,34 @@ cmd_learn (ASSUAN_CONTEXT ctx, char *line) free (serial_and_stamp); } + /* Return information about the certificates. */ + for (idx=0; !rc; idx++) + { + char *certid; + int certtype; + + rc = card_enum_certs (ctrl->card_ctx, idx, &certid, &certtype); + if (!rc) + { + char *buf; + + buf = xtrymalloc (40 + 1 + strlen (certid) + 1); + if (!buf) + rc = GNUPG_Out_Of_Core; + else + { + sprintf (buf, "%d %s", certtype, certid); + assuan_write_status (ctx, "CERTINFO", buf); + xfree (buf); + } + } + xfree (certid); + } + if (rc == -1) + rc = 0; + + + /* Return information about the keys. */ for (idx=0; !rc; idx++) { unsigned char keygrip[20]; |