diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | scard-opensc.c | 26 |
2 files changed, 31 insertions, 1 deletions
@@ -1,4 +1,8 @@ | |||
1 | 20030628 | 1 | 20030628 |
2 | - (djm) Bug #591: use PKCS#15 private key label as a comment in case | ||
3 | of OpenSC. Report and patch from larsch@trustcenter.de | ||
4 | |||
5 | 20030628 | ||
2 | - (dtucker) OpenBSD CVS Sync | 6 | - (dtucker) OpenBSD CVS Sync |
3 | - markus@cvs.openbsd.org 2003/06/23 09:02:44 | 7 | - markus@cvs.openbsd.org 2003/06/23 09:02:44 |
4 | [ssh_config.5] | 8 | [ssh_config.5] |
@@ -603,4 +607,4 @@ | |||
603 | - Fix sshd BindAddress and -b options for systems using fake-getaddrinfo. | 607 | - Fix sshd BindAddress and -b options for systems using fake-getaddrinfo. |
604 | Report from murple@murple.net, diagnosis from dtucker@zip.com.au | 608 | Report from murple@murple.net, diagnosis from dtucker@zip.com.au |
605 | 609 | ||
606 | $Id: ChangeLog,v 1.2829 2003/06/28 02:54:33 dtucker Exp $ | 610 | $Id: ChangeLog,v 1.2830 2003/06/28 08:02:47 djm Exp $ |
diff --git a/scard-opensc.c b/scard-opensc.c index 9766d46cc..e8e12dd85 100644 --- a/scard-opensc.c +++ b/scard-opensc.c | |||
@@ -474,4 +474,30 @@ sc_put_key(Key *prv, const char *id) | |||
474 | return -1; | 474 | return -1; |
475 | } | 475 | } |
476 | 476 | ||
477 | char * | ||
478 | sc_get_key_label(Key *key) | ||
479 | { | ||
480 | int r; | ||
481 | const struct sc_priv_data *priv; | ||
482 | struct sc_pkcs15_object *key_obj; | ||
483 | |||
484 | priv = (const struct sc_priv_data *) RSA_get_app_data(key->rsa); | ||
485 | if (priv == NULL || p15card == NULL) { | ||
486 | logit("SmartCard key not loaded"); | ||
487 | /* internal error => return default label */ | ||
488 | return xstrdup("smartcard key"); | ||
489 | } | ||
490 | r = sc_pkcs15_find_prkey_by_id(p15card, &priv->cert_id, &key_obj); | ||
491 | if (r) { | ||
492 | logit("Unable to find private key from SmartCard: %s", | ||
493 | sc_strerror(r)); | ||
494 | return xstrdup("smartcard key"); | ||
495 | } | ||
496 | if (key_obj == NULL || key_obj->label == NULL) | ||
497 | /* the optional PKCS#15 label does not exists | ||
498 | * => return the default label */ | ||
499 | return xstrdup("smartcard key"); | ||
500 | return xstrdup(key_obj->label); | ||
501 | } | ||
502 | |||
477 | #endif /* SMARTCARD */ | 503 | #endif /* SMARTCARD */ |