Bugzilla – Attachment 325 Details for
Bug 591
use PKCS#15 private key label as a comment in case of OpenSC
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
suggested patch
patch.diff (text/plain), 2.71 KB, created by
Nils Larsch
on 2003-06-10 21:22:47 AEST
(
hide
)
Description:
suggested patch
Filename:
MIME Type:
Creator:
Nils Larsch
Created:
2003-06-10 21:22:47 AEST
Size:
2.71 KB
patch
obsolete
>Index: scard-opensc.c >=================================================================== >RCS file: /cvs/openssh/scard-opensc.c,v >retrieving revision 1.9 >diff -u -r1.9 scard-opensc.c >--- scard-opensc.c 5 Jun 2003 09:19:35 -0000 1.9 >+++ scard-opensc.c 10 Jun 2003 11:11:52 -0000 >@@ -474,4 +474,28 @@ > return -1; > } > >+char * >+sc_get_key_label(const Key *key) >+{ >+ int r; >+ const struct sc_priv_data *priv; >+ struct sc_pkcs15_object *key_obj; >+ >+ priv = (const struct sc_priv_data *) RSA_get_app_data(key->rsa); >+ if (priv == NULL || p15card == NULL) { >+ logit("SmartCard key not loaded"); >+ return NULL; >+ } >+ r = sc_pkcs15_find_prkey_by_id(p15card, &priv->cert_id, &key_obj); >+ if (r) { >+ logit("Unable to find private key from SmartCard: %s", >+ sc_strerror(r)); >+ return NULL; >+ } >+ if (key_obj == NULL || key_obj->label == NULL) >+ /* the optional PKCS#15 label does not exists */ >+ return NULL; >+ return xstrdup(key_obj->label); >+} >+ > #endif /* SMARTCARD */ >Index: scard.c >=================================================================== >RCS file: /cvs/openssh/scard.c,v >retrieving revision 1.26 >diff -u -r1.26 scard.c >--- scard.c 14 May 2003 03:40:07 -0000 1.26 >+++ scard.c 10 Jun 2003 11:11:52 -0000 >@@ -554,4 +554,11 @@ > sectok_close(fd); > return (status); > } >+ >+char * >+sc_get_key_label(const Key *key) >+{ >+ return NULL; >+} >+ > #endif /* SMARTCARD && USE_SECTOK */ >Index: scard.h >=================================================================== >RCS file: /cvs/openssh/scard.h,v >retrieving revision 1.9 >diff -u -r1.9 scard.h >--- scard.h 4 Jul 2002 00:14:18 -0000 1.9 >+++ scard.h 10 Jun 2003 11:11:52 -0000 >@@ -36,5 +36,11 @@ > Key **sc_get_keys(const char *, const char *); > void sc_close(void); > int sc_put_key(Key *, const char *); >+/* sc_get_key_label returns the label of the private key >+ * (if existing) and NULL otherwise. In case of scard-opensc.c >+ * this functions returns the content of the optional PKCS#15 >+ * label field of the CommonObjectAttributes. >+ */ >+char *sc_get_key_label(const Key *); > > #endif >Index: ssh-agent.c >=================================================================== >RCS file: /cvs/openssh/ssh-agent.c,v >retrieving revision 1.119 >diff -u -r1.119 ssh-agent.c >--- ssh-agent.c 4 Jun 2003 12:56:15 -0000 1.119 >+++ ssh-agent.c 10 Jun 2003 11:11:52 -0000 >@@ -602,7 +602,11 @@ > if (lookup_identity(k, version) == NULL) { > id = xmalloc(sizeof(Identity)); > id->key = k; >- id->comment = xstrdup("smartcard key"); >+ id->comment = sc_get_key_label(k); >+ if (id->comment == NULL) >+ /* no key label available, therefore use >+ * standard smartcard key label (comment) */ >+ id->comment = xstrdup("smartcard key"); > id->death = 0; > id->confirm = 0; > TAILQ_INSERT_TAIL(&tab->idlist, id, next);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 591
:
325
|
326
|
329
|
330