You can subscribe to this list here.
2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2013 |
Jan
(26) |
Feb
(64) |
Mar
(78) |
Apr
(36) |
May
(51) |
Jun
(40) |
Jul
(43) |
Aug
(102) |
Sep
(50) |
Oct
(71) |
Nov
(42) |
Dec
(29) |
2014 |
Jan
(49) |
Feb
(52) |
Mar
(56) |
Apr
(30) |
May
(31) |
Jun
(52) |
Jul
(76) |
Aug
(19) |
Sep
(82) |
Oct
(95) |
Nov
(58) |
Dec
(76) |
2015 |
Jan
(135) |
Feb
(43) |
Mar
(47) |
Apr
(72) |
May
(59) |
Jun
(20) |
Jul
(17) |
Aug
(14) |
Sep
(34) |
Oct
(62) |
Nov
(48) |
Dec
(23) |
2016 |
Jan
(18) |
Feb
(55) |
Mar
(24) |
Apr
(20) |
May
(33) |
Jun
(29) |
Jul
(18) |
Aug
(15) |
Sep
(8) |
Oct
(21) |
Nov
(5) |
Dec
(23) |
2017 |
Jan
(3) |
Feb
|
Mar
(17) |
Apr
(4) |
May
|
Jun
(5) |
Jul
(1) |
Aug
(20) |
Sep
(17) |
Oct
(21) |
Nov
|
Dec
(3) |
2018 |
Jan
(62) |
Feb
(4) |
Mar
(4) |
Apr
(20) |
May
(16) |
Jun
|
Jul
(1) |
Aug
(9) |
Sep
(3) |
Oct
(11) |
Nov
|
Dec
(9) |
2019 |
Jan
(1) |
Feb
(1) |
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(2) |
Oct
(5) |
Nov
|
Dec
(5) |
2020 |
Jan
(11) |
Feb
(14) |
Mar
(7) |
Apr
|
May
|
Jun
(3) |
Jul
(3) |
Aug
(6) |
Sep
(2) |
Oct
(15) |
Nov
(11) |
Dec
(7) |
2021 |
Jan
(14) |
Feb
(21) |
Mar
(3) |
Apr
(1) |
May
(1) |
Jun
|
Jul
(1) |
Aug
(1) |
Sep
(3) |
Oct
|
Nov
|
Dec
|
2022 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
(4) |
Nov
(12) |
Dec
|
2023 |
Jan
(2) |
Feb
(4) |
Mar
|
Apr
(8) |
May
|
Jun
(2) |
Jul
|
Aug
(3) |
Sep
(1) |
Oct
|
Nov
(1) |
Dec
(1) |
2024 |
Jan
|
Feb
(2) |
Mar
(6) |
Apr
(1) |
May
|
Jun
(2) |
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
(4) |
Dec
|
2025 |
Jan
(1) |
Feb
|
Mar
|
Apr
(5) |
May
|
Jun
|
Jul
(11) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Anthony F. <ant...@gm...> - 2013-09-03 06:01:14
|
On Wed, Aug 28, 2013 at 10:54 AM, Anthony Foiani <ant...@gm...> wrote: > Douglas, Markus -- > > Thanks very much for pursuing this. > > On Wed, Aug 28, 2013 at 10:19 AM, Douglas E. Engert <dee...@an...> wrote: >> On 8/28/2013 10:37 AM, Markus Kötter wrote: >> > Smartcard-HSM cards do not have cold/hot ATR, they are single ATR. > > And the ATR does match the registry entries. > > But the device manager is showing them with location "ScFilter", which > I thought was the hot/cold handler? Could that be an issue? > > Snapshot of dev manager: > http://foiani.home.dyndns.org/~tony/smart-card-dev-mgr.png > >> > I got these cards myself and they work fine for me on windows 7/x86_64 >> > using the provided registry entries (Wow64 ..) and installing opensc 32 >> > and 64 bit. >> >> Well then maybe Anthony's problem is not having both 32 and 64 bit opensc? > > So far as I know, I installed them both. Yes; "uninstall programs" is > showing "OpenSC" and "OpenSC (64bit)". > > Best regards, > Anthony Foiani |
From: Gary G. <ga...@ga...> - 2013-09-03 03:43:04
|
Using OpenSC on Ubuntu 13.04 version 0.12.2-2ubuntu2 with Cryptoflex 32K v4 card. Attempting to store several key pairs and certificates. Not having any success. Routinely end up with "Failed to store private key: File too small" and "Failed to store private key: Not enough memory on card". Card initialized using pkcs15-init -T --create-pkcs15 using only --so-pin, --so-puk, and --label arguments (as well as variations on this calling out an alternate profile). One auth-id declared with pkcs15-init -T --store-pin. Attempt several pkcs15-init --store-private-key operations. Run out of memory after two. PKCS11 files crafted to have only key+certificate (no CA certificates). Have tried the same with more than one declared auth-id. A few questions: There is no (obvious) specific profile for this card. I assume that /usr/share/opensc/pkcs15.profile is used. Is this correct? I have tried to copy and alter /usr/share/opensc/pkcs15.profile and specify the altered profile as a -p argument to pkcs15-init --create-pkcs15. Is this the correct method? Which profile configuration item adjustments are pertinent to allow for more than two key pairs and associated certificate to be loaded? I have tried this with CA certificates included or excluded. Ideally, I'd like to load the key pair plus certificate plus CA certificates using PKCS11 bundles in typical export form. In my case, more than two. I'm having a rather difficult time understanding how to lay out the profile. It seems I've not understood how to accommodate several key pairs and/or certificates. Importation of a typical PKCS11 bundle including two CA certificates works, but a second with 3 CA certs fails, as does an attempt at three keys with a single certificate each. Regards, Gary |
From: Petr P. <pet...@at...> - 2013-08-31 07:18:51
|
On Sat, Aug 31, 2013 at 09:05:05AM +0200, Petr Pisar wrote: > On Sat, Aug 31, 2013 at 08:24:36AM +0200, NdK wrote: > > TODO: have "some" method to completely disable caching (think "token > > with HOTP login)... > > [...] > > Actually the PIN caching is weired. E.g. there is a non-standard PIN CTRL > command that pre-sets the PIN. I don't like it and I don't think controlling > the caching with yet another private CTRL is good. > And last but not least, you can have more tokens pluged in each with different PIN. Then the caching is obviously wrong because it caches one PIN for all of them. I think the caching should be disabled in the engine_pkcs11 by default. Application can cache the password instead and fill it automatically through the OpenSSL user interface. -- Petr |
From: Anthony F. <ant...@gm...> - 2013-08-31 07:06:52
|
Petr -- On Fri, Aug 30, 2013 at 8:45 AM, Petr Písař <pet...@at...> wrote: > Hello, > > while testing TLS client authentication using a cryprographical token in my > project (libisds over cURL over OpenSSL with Athena USB token under OpenSC), > I found a lot of bugs in the engine_pkcs11 plug-in for OpenSSL. Indeed. :( > Some of the bugs are so serious that they prevent from using the token through > OpenSSL and can lead even to a segmentation fault. So I deciced to fix them > and post the pathes here in hope the engine_pkcs11 maintainer will review them > and merge them. If you're already using this set of patches in production, you might also be interested in my patchset that fixes a severe memory leak with the use of on-token private keys through the engine interface: https://github.com/OpenSC/engine_pkcs11/pull/3 It requires a small change in API -- but without it, I was losing megabytes of memory per hour. Thanks for your code -- I hope it gets integrated soon! Best regards, Tony |
From: Petr P. <pet...@at...> - 2013-08-31 07:05:16
|
On Sat, Aug 31, 2013 at 08:24:36AM +0200, NdK wrote: > Il 30/08/2013 16:45, Petr Písař ha scritto: > > > + /* Login successful, PIN retained in case further logins are > > + required. This will occur on subsequent calls to the > > + pkcs11_load_key function. Subsequent login calls should be > > + relatively fast (the token should maintain its own login > > + state), although there may still be a slight performance > > + penalty. We could maintain state noting that successful > > + login has been performed, but this state may not be updated > > + if the token is removed and reinserted between calls. It > > + seems safer to retain the PIN and peform a login on each > > + call to pkcs11_load_key, even if this may not be strictly > > + necessary. */ > > + /* TODO when does PIN get freed after successful login? */ > > + /* TODO confirm that multiple login attempts do not introduce > > + significant performance penalties */ > TODO: have "some" method to completely disable caching (think "token > with HOTP login)... > I have just moved the code including the comments into a separate function. Actually the PIN caching is weired. E.g. there is a non-standard PIN CTRL command that pre-sets the PIN. I don't like it and I don't think controlling the caching with yet another private CTRL is good. One could augment the dialogue in the get_pin() function to ask user if he wants to cache the PIN. But what about non-interactive log-in? Or one could cache the context with loged-in slot instead of caching mere password. This would work if each process used it's own OpenSSL context. But then how to deal with some `authentication managers' that centrilize the functionality into one daemon instance that proxies application requests. Then you could not distinguish when a token is accessed on behalf of different application. Actually I know almost nothing about p11 or the PKCS11 design regarding sharing log-in state. I worry one behaviour cannot fit to all. -- Petr |
From: NdK <ndk...@gm...> - 2013-08-31 06:24:54
|
Il 30/08/2013 16:45, Petr Písař ha scritto: > + /* Login successful, PIN retained in case further logins are > + required. This will occur on subsequent calls to the > + pkcs11_load_key function. Subsequent login calls should be > + relatively fast (the token should maintain its own login > + state), although there may still be a slight performance > + penalty. We could maintain state noting that successful > + login has been performed, but this state may not be updated > + if the token is removed and reinserted between calls. It > + seems safer to retain the PIN and peform a login on each > + call to pkcs11_load_key, even if this may not be strictly > + necessary. */ > + /* TODO when does PIN get freed after successful login? */ > + /* TODO confirm that multiple login attempts do not introduce > + significant performance penalties */ TODO: have "some" method to completely disable caching (think "token with HOTP login)... BYtE, Diego. |
From: Petr P. <pet...@at...> - 2013-08-30 14:46:05
|
The best way is to execute cd test && OPENSSL_CONF=./openssl.cnf ./load_ssl_client_cert [CA_FILE...] This allows you to test code working with issuing CA names too. --- Makefile.am | 2 +- configure.ac | 1 + test/Makefile.am | 15 +++++++ test/load_ssl_client_cert.c | 98 +++++++++++++++++++++++++++++++++++++++++++++ test/openssl.cnf | 20 +++++++++ 5 files changed, 135 insertions(+), 1 deletion(-) create mode 100644 test/Makefile.am create mode 100644 test/load_ssl_client_cert.c create mode 100644 test/openssl.cnf diff --git a/Makefile.am b/Makefile.am index 6c3f91c..2a0b3b5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -15,7 +15,7 @@ MAINTAINERCLEANFILES = \ $(srcdir)/packaged EXTRA_DIST = svnignore -SUBDIRS = src doc +SUBDIRS = src doc test dist_noinst_SCRIPTS = bootstrap dist_doc_DATA = NEWS diff --git a/configure.ac b/configure.ac index 484f509..0bcc8ba 100644 --- a/configure.ac +++ b/configure.ac @@ -308,6 +308,7 @@ AC_CONFIG_FILES([ doc/nonpersistent/Makefile src/Makefile src/versioninfo.rc + test/Makefile ]) AC_OUTPUT diff --git a/test/Makefile.am b/test/Makefile.am new file mode 100644 index 0000000..d9679b2 --- /dev/null +++ b/test/Makefile.am @@ -0,0 +1,15 @@ +MAINTAINERCLEANFILES = \ + Makefile.in + +OPENSSL_EXTRA_CFLAGS = \ + -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H \ + -DOPENSSL_NO_KRB5 -DL_ENDIAN -DTERMIO -DENGINE_DYNAMIC_SUPPORT \ + -DSHA1_ASM -DMD5_ASM -DRMD160_ASM +AM_CFLAGS = $(OPENSSL_EXTRA_CFLAGS) $(OPENSSL_CFLAGS) +LDADD = $(OPENSSL_LIBS) +AM_LDFLAGS = $(OPENSSL_EXTRA_LDFLAGS) + +noinst_PROGRAMS = load_ssl_client_cert + +load_ssl_client_cert_SOURCES = load_ssl_client_cert.c + diff --git a/test/load_ssl_client_cert.c b/test/load_ssl_client_cert.c new file mode 100644 index 0000000..21dfe2f --- /dev/null +++ b/test/load_ssl_client_cert.c @@ -0,0 +1,98 @@ +#include <stdio.h> +#include <unistd.h> +#include <openssl/conf.h> +#include <openssl/engine.h> +#include <openssl/pem.h> + +STACK_OF(X509_NAME) *load_ca_dns(int argc, char **argv) { + STACK_OF(X509_NAME) *ca_dns = NULL; + BIO *in; + X509 *cert; + X509_NAME *name; + int i; + + for (i = 1; i < argc; i++) { + in = BIO_new_file(argv[i], "r"); + if (NULL == in) { + fprintf(stderr, "Could not read %s\n", argv[i]); + continue; + } + cert = PEM_read_bio_X509(in, NULL, 0, NULL); + BIO_free(in); + if (NULL == cert) { + fprintf(stderr, "Could not read %s\n", argv[i]); + continue; + } + name = X509_NAME_dup(X509_get_subject_name(cert)); + X509_free(cert); + if (NULL == name) { + fprintf(stderr, "Could not get issuer from %s\n", argv[i]); + X509_free(cert); + continue; + } + if (NULL == ca_dns) + ca_dns = sk_X509_NAME_new_null(); + sk_X509_NAME_push(ca_dns, name); + } + return ca_dns; +} + + +int main(int argc, char ** argv) { + ENGINE *e; + const char *engine_id = "pkcs11"; + STACK_OF(X509_NAME) *ca_dns; + X509 *cert = NULL; + EVP_PKEY *pkey = NULL; + int retval; + + printf("Testing %s\n", argv[0]); + + ENGINE_load_builtin_engines(); + OPENSSL_load_builtin_modules(); + if (CONF_modules_load_file(getenv("OPENSSL_CONF"), NULL, 0) <= 0) { + fprintf(stderr, "Could not load modules defined in the " + "configuration file\n"); + exit(EXIT_FAILURE); + } + + e = ENGINE_by_id(engine_id); + if(!e) { + fprintf(stderr, "The engine isn't available\n"); + exit(EXIT_FAILURE); + } + if(!ENGINE_init(e)) { + fprintf(stderr, "The engine couldn't ne initilized\n"); + ENGINE_free(e); + exit(EXIT_FAILURE); + } + + ca_dns = load_ca_dns(argc, argv); + retval = ENGINE_load_ssl_client_cert(e, NULL, ca_dns, &cert, &pkey, NULL, NULL, NULL); + sk_X509_NAME_free(ca_dns); + + if (!retval) { + fprintf(stderr, "ENGINE_load_ssl_client_cert() failed\n"); + ENGINE_finish(e); + ENGINE_free(e); + exit(EXIT_FAILURE); + } + if (NULL != cert) { + printf("A certificate returned:\n"); + X509_print_fp(stdout, cert); + X509_free(cert); + } else { + printf("No certificate returned\n"); + } + if (NULL != pkey) { + printf("A private key returned\n"); + /*EVP_PKEY_free(pkey);*/ + } else { + printf("No private key returned\n"); + } + + ENGINE_finish(e); + ENGINE_free(e); + printf("Ok.\n"); + exit(EXIT_SUCCESS); +} diff --git a/test/openssl.cnf b/test/openssl.cnf new file mode 100644 index 0000000..c4fd1e4 --- /dev/null +++ b/test/openssl.cnf @@ -0,0 +1,20 @@ +#HOME = . +RANDFILE = $ENV::HOME/.rnd + +openssl_conf = openssl_def + +[openssl_def] +engines = engine_section + +[engine_section] +pkcs11 = pkcs11_engine + +[pkcs11_engine] +engine_id = pkcs11 +#dynamic_path = /usr/lib/engines/engine_pkcs11.so +dynamic_path = $ENV::HOME/engine_pkcs11/src/.libs/engine_pkcs11.so +MODULE_PATH = /usr/lib/opensc-pkcs11.so +#PIN = Bar +#VERBOSE = 1 +init = 0 + -- 1.8.1.5 |
From: Petr P. <pet...@at...> - 2013-08-30 14:46:05
|
This feature allows to select approriate certificate and private key for SSL client authentication. An application provides list of certificate authorities known by the server and this code will return suitable certificate and private key. If more certificates are suitable, user will be asked to select one of them. --- src/engine_pkcs11.c | 256 ++++++++++++++++++++++++++++++++++++++++++++++++++++ src/engine_pkcs11.h | 4 + src/hw_pkcs11.c | 3 +- 3 files changed, 262 insertions(+), 1 deletion(-) diff --git a/src/engine_pkcs11.c b/src/engine_pkcs11.c index 1c1842d..992e43e 100644 --- a/src/engine_pkcs11.c +++ b/src/engine_pkcs11.c @@ -31,6 +31,7 @@ #include <openssl/crypto.h> #include <openssl/objects.h> #include <openssl/engine.h> +#include <openssl/x509v3.h> #include <libp11.h> #include "engine_pkcs11.h" @@ -43,6 +44,7 @@ /** The maximum length of an internally-allocated PIN */ #define MAX_PIN_LENGTH 32 +#define MAX_MESSAGE_LENGTH 256 static PKCS11_CTX *ctx; @@ -827,3 +829,257 @@ EVP_PKEY *pkcs11_load_private_key(ENGINE * e, const char *s_key_id, fail("PKCS11_get_private_key returned NULL\n"); return pk; } + +/* + * Return true if certificate issuer is listed in X509_NAME stack or if the + * stack is empty. Return false otherwise. + * + * @cert is a valid PKCS11 certificate + * @issuer_dns is a possibly empty stack of issuer names + */ +static int pkcs11_cert_issuer_matches(PKCS11_CERT *cert, STACK_OF(X509_NAME) *issuer_dns) +{ + int count; + int i; + + if (NULL == issuer_dns) + return 1; + count = sk_X509_NAME_num(issuer_dns); + if (count <= 0) + return 1; + for (i = 0; i < count; i++) { + if (!X509_NAME_cmp( + sk_X509_NAME_value(issuer_dns, i), + X509_get_issuer_name(cert->x509))) + return 1; + } + return 0; +} + + +/* + * Check if certificate can be used by an SSL client. + * + * @cert is a valid PKCS11 certificate. + * @return 1 if the certificate purpose allowes that. + * @return 0 if the certificate purpose prohibits that. + * @return -1 in case of an error. + */ +static int pkcs11_cert_is_for_ssl_client(PKCS11_CERT *cert) +{ + /* XXX: We have to work on a temporary copy because + * X509_check_purpose() modified the X509. */ + X509 *copy = X509_dup(cert->x509); + int suitable; + + if (NULL == copy) + return -1; + suitable = X509_check_purpose(copy, X509_PURPOSE_SSL_CLIENT, 0); + X509_free(copy); + + return suitable; +} + +/* + * Ask user to select a certificate from array of certificates if more + * certificates are listed. Otherwise selects the one certificate without + * asking. + * + * @certs is array of pointers to a PKCS11 certificate + * @cerrs_count is number of pointers in the array + * @ui_method is user interface to use to ask an user + * @callback_data are application data for the user interface + * @return selected certificate or NULL in case of an empty list or an error. + */ +static PKCS11_CERT *pkcs11_select_certificate(PKCS11_CERT **certs, + int certs_count, UI_METHOD *ui_method, void *callback_data) +{ + UI *ui; + char message[MAX_MESSAGE_LENGTH]; + int i; + + /* No certificate list */ + if (NULL == certs || 0 == certs_count) + return NULL; + + /* Exactly one certificate */ + if (1 == certs_count) + return certs[0]; + + /* More certificates, ask the user */ + ui = UI_new(); + if (ui == NULL) { + fail("UI_new failed\n"); + } + if (ui_method != NULL) + UI_set_method(ui, ui_method); + if (callback_data != NULL) + UI_add_user_data(ui, callback_data); + + UI_add_info_string(ui, "Available certificates:\n"); + for (i = 0; i < certs_count; i++) { + char *dn = NULL; + if (certs[i]->x509) + dn = X509_NAME_oneline(X509_get_subject_name + (certs[i]->x509), NULL, 0); + snprintf(message, MAX_MESSAGE_LENGTH - 1, "%2u. %s (%s)\n", + i + 1, certs[i]->label, dn); + message[MAX_MESSAGE_LENGTH-1] = '\0'; + UI_dup_info_string(ui, message); + if (dn) { + OPENSSL_free(dn); + } + } + + message[0] = '\0'; + if (!UI_add_input_string(ui, "Select certificate by number: ", + UI_INPUT_FLAG_ECHO, message, 0, MAX_MESSAGE_LENGTH-1)) { + UI_free(ui); + fail("UI_add_input_string failed\n"); + } + if (UI_process(ui)) { + UI_free(ui); + fail("UI_process failed\n"); + } + UI_free(ui); + + /* Parse the response */ + i = atoi(message); + if (i < 1 || i > certs_count) { + fail("Could not select a certificate because of wrong number\n"); + } + + return certs[i - 1]; +} + +/* + * This is ENGINE_SSL_CLIENT_CERT_PTR OpenSSL engine call-back used to select + * a certificate and a corresponding private key appropriate for SSL client. + * + * @engine is this engine context + * @ssl is current SSL connection in client authentication phase + * @ca_dn is stack of certificate authority distinguished names advertised by + * the SSL server. This list constrains certificate to return. + * @pcert is a memory to store pointer to selected X509 certificate. Only one + * certificate can be returned. + * @pkey us a memory to store pointer to selected private key + * @pother has unkown semantics. Not implemented. + * @ui_method is an user interface to select certificate by the user if there + * are more certificates available issued by one of @ca_dn. + * @return 1 in case of success, otherwise 0. + */ +int pkcs11_load_ssl_client_cert(ENGINE *e, SSL *ssl, + STACK_OF(X509_NAME) *ca_dn, X509 **pcert, EVP_PKEY **pkey, + STACK_OF(X509) **pother, UI_METHOD *ui_method, void *callback_data) +{ + PKCS11_SLOT *slot_list, *slot; + PKCS11_SLOT *found_slot = NULL; + PKCS11_TOKEN *tok; + PKCS11_CERT *certs, *selected_cert = NULL; + PKCS11_CERT **suitable_certs = NULL; + PKCS11_KEY *key; + X509 *x509; + + unsigned int slot_count, cert_count, n, suitable_certs_count; + + if (NULL != pcert) + *pcert = NULL; + if (NULL != pkey) + *pkey = NULL; + if (NULL != pother) + *pother = NULL; + + if (NULL == e) + return 0; + + /* Enumerate certificates */ + if (PKCS11_enumerate_slots(ctx, &slot_list, &slot_count) < 0) + fail0("failed to enumerate slots\n"); + if (!(slot = PKCS11_find_token(ctx, slot_list, slot_count))) { + PKCS11_release_all_slots(ctx, slot_list, slot_count); + fail0("didn't find any tokens\n"); + } + tok = slot->token; + if (tok == NULL) { + PKCS11_release_all_slots(ctx, slot_list, slot_count); + fail0("Found empty token\n"); + } + + if (PKCS11_enumerate_certs(tok, &certs, &cert_count)) { + PKCS11_release_all_slots(ctx, slot_list, slot_count); + fail0("unable to enumerate certificates\n"); + } + + /* Select suitable certificates */ + suitable_certs = malloc(cert_count * sizeof(*suitable_certs)); + if (NULL == suitable_certs) { + PKCS11_release_all_slots(ctx, slot_list, slot_count); + fail0("not enough memory to select certificates\n"); + } + + for (n = 0, suitable_certs_count = 0; n < cert_count; n++) { + PKCS11_CERT *k = certs + n; + if (pkcs11_cert_issuer_matches(k, ca_dn)) { + int suitable = pkcs11_cert_is_for_ssl_client(k); + /* ???: Exclude expired certificates */ + if (1 == suitable) { + /* Suitable certificate found */ + suitable_certs[suitable_certs_count++] = k; + } else if (0 != suitable) { + free(suitable_certs); + PKCS11_release_all_slots(ctx, slot_list, + slot_count); + fail0("Error while checking a certificate is " + "allowed for an SSL client\n"); + } + } + } + + /* Let user to select if more certificates are suitable */ + selected_cert = pkcs11_select_certificate(suitable_certs, suitable_certs_count, + ui_method, callback_data); + free(suitable_certs); + + /* Store selected certificate */ + if (NULL == selected_cert) { + PKCS11_release_all_slots(ctx, slot_list, slot_count); + fail0("No suitable certificate found\n"); + } + if (NULL != pcert) { + *pcert = X509_dup(selected_cert->x509); + if (NULL == *pcert) { + PKCS11_release_all_slots(ctx, slot_list, slot_count); + fail0("could not copy selected certificate\n"); + } + } + + if (NULL == pkey) { + /* No private key requested by an application */ + PKCS11_release_all_slots(ctx, slot_list, slot_count); + return (1); + } + + /* Find a private key corresponding to the certificate */ + if (!pkcs11_login(slot, tok, ui_method, callback_data)) { + PKCS11_release_all_slots(ctx, slot_list, slot_count); + if (NULL != *pcert) { + X509_free(*pcert); + *pcert = NULL; + } + fail0("could not log in to access private key corresponding to selected certificate\n"); + } + key = PKCS11_find_key(selected_cert); + if (NULL == key) { + PKCS11_release_all_slots(ctx, slot_list, slot_count); + if (NULL != *pcert) { + X509_free(*pcert); + *pcert = NULL; + } + fail0("could not find private key corresponding to selected certificate\n"); + } + /* ???: Duplicate EVP_PKEY as the X509 */ + *pkey = PKCS11_get_private_key(key); + + PKCS11_release_all_slots(ctx, slot_list, slot_count); + return (1); +} diff --git a/src/engine_pkcs11.h b/src/engine_pkcs11.h index 2159330..3bc55fb 100644 --- a/src/engine_pkcs11.h +++ b/src/engine_pkcs11.h @@ -55,4 +55,8 @@ EVP_PKEY *pkcs11_load_public_key(ENGINE * e, const char *s_key_id, EVP_PKEY *pkcs11_load_private_key(ENGINE * e, const char *s_key_id, UI_METHOD * ui_method, void *callback_data); +int pkcs11_load_ssl_client_cert(ENGINE *e, SSL *ssl, + STACK_OF(X509_NAME) *ca_dn, X509 **pcert, EVP_PKEY **pkey, + STACK_OF(X509) **pother, UI_METHOD *ui_method, void *callback_data); + #endif diff --git a/src/hw_pkcs11.c b/src/hw_pkcs11.c index 24806ff..f6e45d5 100644 --- a/src/hw_pkcs11.c +++ b/src/hw_pkcs11.c @@ -193,7 +193,8 @@ static int bind_helper(ENGINE * e) !ENGINE_set_BN_mod_exp(e, BN_mod_exp) || #endif !ENGINE_set_load_pubkey_function(e, pkcs11_load_public_key) || - !ENGINE_set_load_privkey_function(e, pkcs11_load_private_key)) { + !ENGINE_set_load_privkey_function(e, pkcs11_load_private_key) || + !ENGINE_set_load_ssl_client_cert_function(e, pkcs11_load_ssl_client_cert)) { return 0; } else { return 1; -- 1.8.1.5 |
From: Petr P. <pet...@at...> - 2013-08-30 14:46:04
|
--- src/engine_pkcs11.c | 101 +++++++++++++++++++++++++++++++--------------------- 1 file changed, 60 insertions(+), 41 deletions(-) diff --git a/src/engine_pkcs11.c b/src/engine_pkcs11.c index 34b65d6..1c1842d 100644 --- a/src/engine_pkcs11.c +++ b/src/engine_pkcs11.c @@ -39,6 +39,7 @@ #endif #define fail(msg) { fprintf(stderr,msg); return NULL;} +#define fail0(msg) { fprintf(stderr,msg); return 0;} /** The maximum length of an internally-allocated PIN */ #define MAX_PIN_LENGTH 32 @@ -545,6 +546,63 @@ int load_cert_ctrl(ENGINE * e, void *p) return 1; } +/* + * Log-into the token if necesary. + * + * @slot is PKCS11 slot to log in + * @tok is PKCS11 token to log in (??? could be derived as @slot->token) + * @ui_method is OpenSSL user inteface which is used to ask for a password + * @callback_data are application data to the user interface + * @return 1 on success, 0 on error. + */ +static int pkcs11_login(PKCS11_SLOT *slot, PKCS11_TOKEN *tok, UI_METHOD *ui_method, void *callback_data) +{ + /* Perform login to the token if required */ + if (tok->loginRequired) { + /* If the token has a secure login (i.e., an external keypad), + then use a NULL pin. Otherwise, check if a PIN exists. If + not, allocate and obtain a new PIN. */ + if (tok->secureLogin) { + /* Free the PIN if it has already been + assigned (i.e, cached by get_pin) */ + free_pin(); + } else if (pin == NULL) { + pin = (char *)calloc(MAX_PIN_LENGTH, sizeof(char)); + pin_length = MAX_PIN_LENGTH; + if (pin == NULL) { + fail0("Could not allocate memory for PIN\n"); + } + if (!get_pin(ui_method, callback_data) ) { + free_pin(); + fail0("No pin code was entered\n"); + } + } + + /* Now login in with the (possibly NULL) pin */ + if (PKCS11_login(slot, 0, pin)) { + /* Login failed, so free the PIN if present */ + free_pin(); + fail0("Login failed\n"); + } + /* Login successful, PIN retained in case further logins are + required. This will occur on subsequent calls to the + pkcs11_load_key function. Subsequent login calls should be + relatively fast (the token should maintain its own login + state), although there may still be a slight performance + penalty. We could maintain state noting that successful + login has been performed, but this state may not be updated + if the token is removed and reinserted between calls. It + seems safer to retain the PIN and peform a login on each + call to pkcs11_load_key, even if this may not be strictly + necessary. */ + /* TODO when does PIN get freed after successful login? */ + /* TODO confirm that multiple login attempts do not introduce + significant performance penalties */ + + } + return 1; +} + static EVP_PKEY *pkcs11_load_key(ENGINE * e, const char *s_slot_key_id, UI_METHOD * ui_method, void *callback_data, int isPrivate) @@ -691,47 +749,8 @@ static EVP_PKEY *pkcs11_load_key(ENGINE * e, const char *s_slot_key_id, } /* Perform login to the token if required */ - if (tok->loginRequired) { - /* If the token has a secure login (i.e., an external keypad), - then use a NULL pin. Otherwise, check if a PIN exists. If - not, allocate and obtain a new PIN. */ - if (tok->secureLogin) { - /* Free the PIN if it has already been - assigned (i.e, cached by get_pin) */ - free_pin(); - } else if (pin == NULL) { - pin = (char *)calloc(MAX_PIN_LENGTH, sizeof(char)); - pin_length = MAX_PIN_LENGTH; - if (pin == NULL) { - fail("Could not allocate memory for PIN"); - } - if (!get_pin(ui_method, callback_data) ) { - free_pin(); - fail("No pin code was entered"); - } - } - - /* Now login in with the (possibly NULL) pin */ - if (PKCS11_login(slot, 0, pin)) { - /* Login failed, so free the PIN if present */ - free_pin(); - fail("Login failed\n"); - } - /* Login successful, PIN retained in case further logins are - required. This will occur on subsequent calls to the - pkcs11_load_key function. Subsequent login calls should be - relatively fast (the token should maintain its own login - state), although there may still be a slight performance - penalty. We could maintain state noting that successful - login has been performed, but this state may not be updated - if the token is removed and reinserted between calls. It - seems safer to retain the PIN and peform a login on each - call to pkcs11_load_key, even if this may not be strictly - necessary. */ - /* TODO when does PIN get freed after successful login? */ - /* TODO confirm that multiple login attempts do not introduce - significant performance penalties */ - + if (!pkcs11_login(slot, tok, ui_method, callback_data)) { + return NULL; } /* Make sure there is at least one private key on the token */ -- 1.8.1.5 |
From: Petr P. <pet...@at...> - 2013-08-30 14:46:03
|
Previously, it was not possible to load a certificate by a label because it alwayes searched by undefined ID value. This has been fixed to behave in the same way as searching for a key. --- src/engine_pkcs11.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/engine_pkcs11.c b/src/engine_pkcs11.c index 42d90e2..34b65d6 100644 --- a/src/engine_pkcs11.c +++ b/src/engine_pkcs11.c @@ -497,13 +497,19 @@ static X509 *pkcs11_load_cert(ENGINE * e, const char *s_slot_cert_id) fprintf(stderr, "Found %u cert%s:\n", cert_count, (cert_count <= 1) ? "" : "s"); } - if ((s_slot_cert_id && *s_slot_cert_id) && (cert_id_len != 0)) { + if ((s_slot_cert_id && *s_slot_cert_id) && (cert_id_len != 0 || cert_label != NULL)) { for (n = 0; n < cert_count; n++) { PKCS11_CERT *k = certs + n; - if (cert_id_len != 0 && k->id_len == cert_id_len && - memcmp(k->id, cert_id, cert_id_len) == 0) { - selected_cert = k; + if (cert_label == NULL) { + if (cert_id_len != 0 && k->id_len == cert_id_len && + memcmp(k->id, cert_id, cert_id_len) == 0) { + selected_cert = k; + } + } else { + if (strcmp(k->label, cert_label) == 0) { + selected_cert = k; + } } } } else { -- 1.8.1.5 |
From: Petr P. <pet...@at...> - 2013-08-30 14:46:01
|
label_<label> allows to search for any token, let's behave the same way with id_<ID> or <ID> too. Without this patch, id_<ID> did not work despite the label_<label> worked. Especially if the only used slot number is different from 0. --- src/engine_pkcs11.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/engine_pkcs11.c b/src/engine_pkcs11.c index 65289a7..42d90e2 100644 --- a/src/engine_pkcs11.c +++ b/src/engine_pkcs11.c @@ -260,14 +260,14 @@ static int parse_slot_id_string(const char *slot_id, int *slot, #define HEXDIGITS "01234567890ABCDEFabcdef:" #define DIGITS "0123456789" - /* first: pure hex number (id, slot is 0) */ + /* first: pure hex number (id, slot is undefined) */ if (strspn(slot_id, HEXDIGITS) == strlen(slot_id)) { /* ah, easiest case: only hex. */ if ((strlen(slot_id) + 1) / 2 > *id_len) { fprintf(stderr, "id string too long!\n"); return 0; } - *slot = 0; + *slot = -1; return hex_to_bin(slot_id, id, id_len); } @@ -298,7 +298,7 @@ static int parse_slot_id_string(const char *slot_id, int *slot, return hex_to_bin(slot_id + i, id, id_len); } - /* third: id_<id> */ + /* third: id_<id>, slot is undefined */ if (strncmp(slot_id, "id_", 3) == 0) { if (strspn(slot_id + 3, HEXDIGITS) + 3 != strlen(slot_id)) { fprintf(stderr, "could not parse string!\n"); @@ -309,12 +309,13 @@ static int parse_slot_id_string(const char *slot_id, int *slot, fprintf(stderr, "id string too long!\n"); return 0; } - *slot = 0; + *slot = -1; return hex_to_bin(slot_id + 3, id, id_len); } - /* label_<label> */ + /* label_<label>, slot is undefined */ if (strncmp(slot_id, "label_", 6) == 0) { + *slot = -1; *label = strdup(slot_id + 6); return *label != NULL; } -- 1.8.1.5 |
From: Petr P. <pet...@at...> - 2013-08-30 14:46:00
|
The hexadecimal ID string is supposed to separate nibbles by a colon, so to recognize the string as such. Plain <ID> will clash with <slot>:<ID> syntax but there is no help. User should use slot_<slot>-id_<ID> instead. --- src/engine_pkcs11.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/engine_pkcs11.c b/src/engine_pkcs11.c index 829b59d..65289a7 100644 --- a/src/engine_pkcs11.c +++ b/src/engine_pkcs11.c @@ -257,7 +257,7 @@ static int parse_slot_id_string(const char *slot_id, int *slot, return 0; /* support for several formats */ -#define HEXDIGITS "01234567890ABCDEFabcdef" +#define HEXDIGITS "01234567890ABCDEFabcdef:" #define DIGITS "0123456789" /* first: pure hex number (id, slot is 0) */ -- 1.8.1.5 |
From: Petr P. <pet...@at...> - 2013-08-30 14:45:59
|
--- src/engine_pkcs11.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/engine_pkcs11.c b/src/engine_pkcs11.c index 6e248e4..0c0b383 100644 --- a/src/engine_pkcs11.c +++ b/src/engine_pkcs11.c @@ -101,6 +101,7 @@ int set_pin(const char *_pin) /* Copy the PIN. If the string cannot be copied, NULL shall be returned and errno shall be set. */ + free_pin(); pin = strdup(_pin); if (pin != NULL) pin_length = strlen(pin); @@ -127,6 +128,7 @@ static int get_pin(UI_METHOD * ui_method, void *callback_data) /* pin in the call back data, copy and use */ if (mycb != NULL && mycb->password) { + free_pin(); pin = (char *)calloc(MAX_PIN_LENGTH, sizeof(char)); if (!pin) return 0; @@ -142,6 +144,11 @@ static int get_pin(UI_METHOD * ui_method, void *callback_data) if (callback_data != NULL) UI_set_app_data(ui, callback_data); + free_pin(); + pin = (char *)calloc(MAX_PIN_LENGTH, sizeof(char)); + if (!pin) + return 0; + pin_length = MAX_PIN_LENGTH; if (!UI_add_input_string (ui, "PKCS#11 token PIN: ", 0, pin, 1, MAX_PIN_LENGTH)) { fprintf(stderr, "UI_add_input_string failed\n"); -- 1.8.1.5 |
From: Petr P. <pet...@at...> - 2013-08-30 14:45:59
|
Call-back data passed by the OpenSSL from an application are application specific data opaque to an engine. Previous engine_pkcs11 code tried to use the call-back data which could result in crash. This patch fixes it. --- src/engine_pkcs11.c | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/src/engine_pkcs11.c b/src/engine_pkcs11.c index 0c0b383..829b59d 100644 --- a/src/engine_pkcs11.c +++ b/src/engine_pkcs11.c @@ -115,34 +115,24 @@ int inc_verbose(void) return 1; } -/* either get the pin code from the supplied callback data, or get the pin - * via asking our self. In both cases keep a copy of the pin code in the - * pin variable (strdup'ed copy). */ +/* Get the PIN via asking user interface. The supplied call-back data are + * passed to the user interface implemented by an application. Only the + * application knows how to interpret the call-back data. + * A (strdup'ed) copy of the PIN code will be stored in the pin variable. */ static int get_pin(UI_METHOD * ui_method, void *callback_data) { UI *ui; - struct { - const void *password; - const char *prompt_info; - } *mycb = callback_data; - - /* pin in the call back data, copy and use */ - if (mycb != NULL && mycb->password) { - free_pin(); - pin = (char *)calloc(MAX_PIN_LENGTH, sizeof(char)); - if (!pin) - return 0; - strncpy(pin,mycb->password,MAX_PIN_LENGTH); - pin_length = MAX_PIN_LENGTH; - return 1; - } /* call ui to ask for a pin */ ui = UI_new(); + if (ui == NULL) { + fprintf(stderr, "UI_new failed\n"); + return 0; + } if (ui_method != NULL) UI_set_method(ui, ui_method); if (callback_data != NULL) - UI_set_app_data(ui, callback_data); + UI_add_user_data(ui, callback_data); free_pin(); pin = (char *)calloc(MAX_PIN_LENGTH, sizeof(char)); @@ -150,7 +140,8 @@ static int get_pin(UI_METHOD * ui_method, void *callback_data) return 0; pin_length = MAX_PIN_LENGTH; if (!UI_add_input_string - (ui, "PKCS#11 token PIN: ", 0, pin, 1, MAX_PIN_LENGTH)) { + (ui, "PKCS#11 token PIN: ", UI_INPUT_FLAG_DEFAULT_PWD, + pin, 1, MAX_PIN_LENGTH)) { fprintf(stderr, "UI_add_input_string failed\n"); UI_free(ui); return 0; -- 1.8.1.5 |
From: Petr P. <pet...@at...> - 2013-08-30 14:45:59
|
Hello, while testing TLS client authentication using a cryprographical token in my project (libisds over cURL over OpenSSL with Athena USB token under OpenSC), I found a lot of bugs in the engine_pkcs11 plug-in for OpenSSL. Some of the bugs are so serious that they prevent from using the token through OpenSSL and can lead even to a segmentation fault. So I deciced to fix them and post the pathes here in hope the engine_pkcs11 maintainer will review them and merge them. Here is a short description, patches will be sent as replies: [PATCH 1/9] Unify PIN freeing [PATCH 2/9] Free PIN storage where needed These two patches fix memory leaks when storing a PIN code. [PATCH 3/9] Use user interface correctly This fixes a crash (segmenation fault) when loading a private key. Current code could never use a PIN passed from OpenSSL because of wrong usage of the user interface call-back data. I send a fix to cURL library <http://thread.gmane.org/gmane.comp.web.curl.library/40222> too and I tested the colaboration between cURL and engine_pkcs11 successfully. [PATCH 4/9] Hexadecimal ID string contains colons A certificate/key object hexadecimal ID is printed with colons (ab:cd:..) everywhere. Let's allow engine_pkcs11 to recognize it. Contrary current parser expects the colons by can not recognize such string as an ID. I believe it was not possible to use the hexadecimal ID before. [PATCH 5/9] Find token if no slot was specified Identifier wihout a slot number (e.g. a plain ID) always resulted to slot number 0. This searches all slots now. [PATCH 6/9] Search for a certificate by a label Searching a certificate by a label did not work and worked differently than searching a key. This caused a lot of confusion why OpenSSL can locate the key but it cannot locate the certificate. [PATCH 7/9] Decouple loging into the token [PATCH 8/9] Implement ENGINE_load_ssl_client_cert() [PATCH 9/9] Add load_ssl_client_cert test These tree patches implement ENGINE_load_ssl_client_cert() interface which allows automatic negotion of client certificate in TLS authenticatinon. The ninth patch provides a test. -- Petr |
From: Petr P. <pet...@at...> - 2013-08-30 14:45:58
|
--- src/engine_pkcs11.c | 45 +++++++++++++++++---------------------------- 1 file changed, 17 insertions(+), 28 deletions(-) diff --git a/src/engine_pkcs11.c b/src/engine_pkcs11.c index c1b8fbb..6e248e4 100644 --- a/src/engine_pkcs11.c +++ b/src/engine_pkcs11.c @@ -66,6 +66,18 @@ int set_module(const char *modulename) return 1; } + +/* Free PIN storage in secure way. */ +static void free_pin(void) +{ + if (pin != NULL) { + OPENSSL_cleanse(pin, pin_length); + free(pin); + pin = NULL; + pin_length = 0; + } +} + /** * Set the PIN used for login. A copy of the PIN shall be made. * @@ -158,12 +170,7 @@ int pkcs11_finish(ENGINE * engine) PKCS11_CTX_free(ctx); ctx = NULL; } - if (pin != NULL) { - OPENSSL_cleanse(pin, pin_length); - free(pin); - pin = NULL; - pin_length = 0; - } + free_pin(); return 1; } @@ -183,12 +190,7 @@ int pkcs11_init(ENGINE * engine) int pkcs11_rsa_finish(RSA * rsa) { - if (pin) { - OPENSSL_cleanse(pin, pin_length); - free(pin); - pin = NULL; - pin_length = 0; - } + free_pin(); if (module) { free(module); module = NULL; @@ -691,12 +693,7 @@ static EVP_PKEY *pkcs11_load_key(ENGINE * e, const char *s_slot_key_id, if (tok->secureLogin) { /* Free the PIN if it has already been assigned (i.e, cached by get_pin) */ - if (pin != NULL) { - OPENSSL_cleanse(pin, pin_length); - free(pin); - pin = NULL; - pin_length = 0; - } + free_pin(); } else if (pin == NULL) { pin = (char *)calloc(MAX_PIN_LENGTH, sizeof(char)); pin_length = MAX_PIN_LENGTH; @@ -704,10 +701,7 @@ static EVP_PKEY *pkcs11_load_key(ENGINE * e, const char *s_slot_key_id, fail("Could not allocate memory for PIN"); } if (!get_pin(ui_method, callback_data) ) { - OPENSSL_cleanse(pin, pin_length); - free(pin); - pin = NULL; - pin_length = 0; + free_pin(); fail("No pin code was entered"); } } @@ -715,12 +709,7 @@ static EVP_PKEY *pkcs11_load_key(ENGINE * e, const char *s_slot_key_id, /* Now login in with the (possibly NULL) pin */ if (PKCS11_login(slot, 0, pin)) { /* Login failed, so free the PIN if present */ - if (pin != NULL) { - OPENSSL_cleanse(pin, pin_length); - free(pin); - pin = NULL; - pin_length = 0; - } + free_pin(); fail("Login failed\n"); } /* Login successful, PIN retained in case further logins are -- 1.8.1.5 |
From: Anthony F. <ant...@gm...> - 2013-08-30 00:07:07
|
Hello Lists! (Hint, it's easier to write a human response if you offer at least a first name...) Anyway. I'm using the SC-HSM under linux successfully (and, with just opensc / pcsclite, under windows 7). You shouldn't need openct; the SC-HSM reader is CCID compilant, so pcsclite (pcscd) should work just fine. I did rebuilt it myself, but that was due to the changes merged into opensc after my distribution (Fedora 18) built their copy. Using the attached script to rebuild my stack, here's the results: $ opensc-tool -i opensc 0.13.0 [gcc 4.7.2 20121109 (Red Hat 4.7.2-8)] Enabled features: zlib openssl pcsc(libpcsclite.so.1) $ opensc-tool --list-readers -v # Detected readers (pcsc) Nr. Card Features Name 0 Yes SCM Microsystems Inc. SCR 355 00 00 3b:fe:18:00:00:81:31:fe:45:80:31:81:54:48:53:4d:31:73:80:21:40:81:07:fa SmartCard-HSM $ pkcs15-tool -D Using reader with a card: SCM Microsystems Inc. SCR 355 00 00 PKCS#15 Card [SmartCard-HSM]: Version : 0 Serial number : UTTM000xxxx Manufacturer ID: www.CardContact.de Flags : ... So try it again with pcsclite / libccid instead of openct. Best regards, Anthony Foiani On Thu, Aug 29, 2013 at 3:57 PM, <li...@no...> wrote: > > My Smartcard-HSM (USB form) is recognised by the OS but not by opensc. > > Linux version 3.7.10-1.16-desktop (geeko@buildhost) (gcc version 4.7.2 20130108 [gcc-4_7-branch revision 195012] (SUSE Linux) ) #1 SMP PREEMPT Fri May 31 20:21:23 UTC 2013 (97c14ba) > > │ ├┬─SCx35xx v2.0 USB SC Reader │ > │ │├──Bus: USB │ > │ │├──Class (spec): │ > │ │├──Class: Chipcard reader │ > │ │├──Device Identifier: 218128 │ > │ │├──Device: SCx35xx v2.0 USB SC Reader │ > │ │├──Hwcfg Bus: usb │ > │ │├──Model: SCM Microsystems SCx35xx v2.0 USB SC Reader │ > │ │├──Old Unique Key: NLLf.qkb4Y46c0A0 ┬ > │ │├──Parent Unique ID: zPk0.AJzOe6ShP50 │ > │ │├+─Resources │ > │ │├──Revision: 3.04 │ > │ │├──Sysfs ID: /devices/pci0000:00/0000:00:13.2/usb4/4-1/4-1:1.0 │ > │ │├──Sysfs ID: 4-1:1.0 │ > │ │├──Unique Key: PYMB.hPVszvRlKk4 ┴ > │ │├──Vendor Identifier: 197862 │ > │ │├──Vendor: SCM Microsystems, Inc. │ > │ │├──hotplug: usb │ > │ │└──modalias: usb:v04E6p5410d0304dc00dsc00dp00ic0Bisc00ip00in00 > > > Because it's USB I've compiled with openct (I also tried pcsc-lite). > > $ opensc-tool -i > opensc 0.13.0 [gcc 4.7.2 20130108 [gcc-4_7-branch revision 195012]] > Enabled features: zlib openssl openct > > $ opensc-tool --list-readers -vv > # Detected readers (openct) > Nr. Card Features Name > 0x7f11036bc700 22:52:36.160 [opensc-tool] reader-openct.c:173:openct_reader_detect_card_presence: called > 0 No OpenCT reader (detached) > 0x7f11036bc700 22:52:36.161 [opensc-tool] reader-openct.c:173:openct_reader_detect_card_presence: called > 1 No OpenCT reader (detached) > 0x7f11036bc700 22:52:36.161 [opensc-tool] ctx.c:787:sc_release_context: called > 0x7f11036bc700 22:52:36.161 [opensc-tool] reader-openct.c:153:openct_reader_release: called > 0x7f11036bc700 22:52:36.161 [opensc-tool] reader-openct.c:153:openct_reader_release: called > 0x7f11036bc700 22:52:36.161 [opensc-tool] reader-openct.c:140:openct_reader_finish: called > > > $ pkcs11-tool --module /usr/local/lib/opensc-pkcs11.so -L > Available slots: > Slot 0 (0xffffffffffffffff): Virtual hotplug slot > (empty) > Slot 1 (0x1): OpenCT reader (detached) > (empty) > Slot 2 (0x5): OpenCT reader (detached) > (empty) > > $ pkcs11-tool --module /usr/local/lib/opensc-pkcs11.so -T > Available slots: > No slots. > > > What else should I look into? Is there a more suitable forum than this? > > Thanks. > > ------------------------------------------------------------------------------ > Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more! > Discover the easy way to master current and previous Microsoft technologies > and advance your career. Get an incredible 1,500+ hours of step-by-step > tutorial videos with LearnDevNow. Subscribe today and save! > http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk > _______________________________________________ > Opensc-devel mailing list > Ope...@li... > https://lists.sourceforge.net/lists/listinfo/opensc-devel |
From: <li...@no...> - 2013-08-29 21:57:51
|
My Smartcard-HSM (USB form) is recognised by the OS but not by opensc. Linux version 3.7.10-1.16-desktop (geeko@buildhost) (gcc version 4.7.2 20130108 [gcc-4_7-branch revision 195012] (SUSE Linux) ) #1 SMP PREEMPT Fri May 31 20:21:23 UTC 2013 (97c14ba) │ ├┬─SCx35xx v2.0 USB SC Reader │ │ │├──Bus: USB │ │ │├──Class (spec): │ │ │├──Class: Chipcard reader │ │ │├──Device Identifier: 218128 │ │ │├──Device: SCx35xx v2.0 USB SC Reader │ │ │├──Hwcfg Bus: usb │ │ │├──Model: SCM Microsystems SCx35xx v2.0 USB SC Reader │ │ │├──Old Unique Key: NLLf.qkb4Y46c0A0 ┬ │ │├──Parent Unique ID: zPk0.AJzOe6ShP50 │ │ │├+─Resources │ │ │├──Revision: 3.04 │ │ │├──Sysfs ID: /devices/pci0000:00/0000:00:13.2/usb4/4-1/4-1:1.0 │ │ │├──Sysfs ID: 4-1:1.0 │ │ │├──Unique Key: PYMB.hPVszvRlKk4 ┴ │ │├──Vendor Identifier: 197862 │ │ │├──Vendor: SCM Microsystems, Inc. │ │ │├──hotplug: usb │ │ │└──modalias: usb:v04E6p5410d0304dc00dsc00dp00ic0Bisc00ip00in00 Because it's USB I've compiled with openct (I also tried pcsc-lite). $ opensc-tool -i opensc 0.13.0 [gcc 4.7.2 20130108 [gcc-4_7-branch revision 195012]] Enabled features: zlib openssl openct $ opensc-tool --list-readers -vv # Detected readers (openct) Nr. Card Features Name 0x7f11036bc700 22:52:36.160 [opensc-tool] reader-openct.c:173:openct_reader_detect_card_presence: called 0 No OpenCT reader (detached) 0x7f11036bc700 22:52:36.161 [opensc-tool] reader-openct.c:173:openct_reader_detect_card_presence: called 1 No OpenCT reader (detached) 0x7f11036bc700 22:52:36.161 [opensc-tool] ctx.c:787:sc_release_context: called 0x7f11036bc700 22:52:36.161 [opensc-tool] reader-openct.c:153:openct_reader_release: called 0x7f11036bc700 22:52:36.161 [opensc-tool] reader-openct.c:153:openct_reader_release: called 0x7f11036bc700 22:52:36.161 [opensc-tool] reader-openct.c:140:openct_reader_finish: called $ pkcs11-tool --module /usr/local/lib/opensc-pkcs11.so -L Available slots: Slot 0 (0xffffffffffffffff): Virtual hotplug slot (empty) Slot 1 (0x1): OpenCT reader (detached) (empty) Slot 2 (0x5): OpenCT reader (detached) (empty) $ pkcs11-tool --module /usr/local/lib/opensc-pkcs11.so -T Available slots: No slots. What else should I look into? Is there a more suitable forum than this? Thanks. |
From: Jean-Michel P. - G. <jm...@go...> - 2013-08-29 21:46:08
|
Le jeudi 29 août 2013 à 18:03 +0200, Anders Rundgren a écrit : > JM, actual *usage* of certificates issued over the Internet in the > EU already exceed that of smart cards for the reasons I have mentioned > over and over: the lack of usable standards that doesn't require > end-users to hang out in OpenSC list... Dear Anders, This is not a reason for replacing security for a few with no security for everyone. I don't get the point where hacked devices from design should replace normal computers, just because they include a crypto chip. Now your project to work on Internet delivery of certificates is very interesting, but it surely will never happen on G**** side, AFAIK. It can only be your project or the project of another company. If you hang around Paris, just drop me an email, I will be glad to meet you! Kind regards, -- Jean-Michel Pouré - Gooze - http://www.gooze.eu |
From: Douglas E. E. <dee...@an...> - 2013-08-29 16:26:36
|
On 8/29/2013 3:08 AM, Ludovic Rousseau wrote: > 2013/8/28 Douglas E. Engert <dee...@an...>: >> We keep saying in responses to e-mails statements like: >> "The project do not use opensc-project.org any more. >> Read https://github.com/OpenSC/OpenSC/wiki/OpenSC-Services" >> >> But if an ordinary users Googles for OpenSC subjects >> a reference to github may not even show up in the first 100 >> responses. >> >> This continues to lead users to the old pages and the project >> appears to be dead! >> >> For example Google for: >> Getting started with OpenSC >> shows https://www.opensc-project.org/opensc/wiki/GetStarted >> Last updated 2 years ago. >> >> But Google with it in quotes: "Getting started with OpenSC" >> and github is first. >> https://github.com/OpenSC/OpenSC/wiki/Getting-started-with-OpenSC >> Updated 8 months ago. >> (Don't ask me why Google does this, it just does.) >> >> One way to help users find the up to date pages would be to add >> to every page on the old >> https://www.opensc-project.org/opensc/wiki >> >> some box saying the project has moved to github, >> and the Wiki can be found at: >> https://www.opensc-project.org/opensc/wiki > > I updated the wiki page above. > I do not want to edit _every_ wiki pages at > https://www.opensc-project.org/ That is too much work. Does the wiki have a way to put a header on every page? That could say project moved to https://github.com/OpenSC/OpenSC/wiki/ Not only do search engines put us low, older e-mail archives with have URLs pointing to www.opensc-project.org Any way to have the web server redirect users to the new Wiki? > > Thanks for the reminder. > > Bye > -- Douglas E. Engert <DEE...@an...> Argonne National Laboratory 9700 South Cass Avenue Argonne, Illinois 60439 (630) 252-5444 |
From: Anders R. <and...@gm...> - 2013-08-29 16:03:45
|
On 2013-08-29 14:58, Jean-Michel Pouré - GOOZE wrote: <snip> > > Thank you again for this interesting article, which convinced me to > avoid any management of certificates over Internet. JM, actual *usage* of certificates issued over the Internet in the EU already exceed that of smart cards for the reasons I have mentioned over and over: the lack of usable standards that doesn't require end-users to hang out in OpenSC list... > So the future belongs to smartcards and USB tokens. For e-passports and governments, yes. For the private sector including banks the future looks awfully grim unless Feitian and other vendors begin to take the threat from Google a bit more serious. My guess is that they probably will wait until it is all over. > We draw a different conclusion as > yours. And this is still needed to register cryto-chips at ANSSI, > France, for security and also freedom. The French crypto-laws are bizarre IMO. I'm moving to France in September :-) Cheers Anders > |
From: Jean-Michel P. - G. <jm...@go...> - 2013-08-29 13:09:34
|
Le mercredi 28 août 2013 à 10:45 -0500, Douglas E. Engert a écrit : > Any other suggestions? You need to register a Google Analytics project and publish an XML sitemap with all pages included in the web project. This will result in #1 rank on Google. Or if Google does not like you, you will be on page #100 in any other situations. Behind Google, there are ranking humans and/or Internet policies. I discussed with one of those guys once. He was spending hours ranking websites and you have a very limited time, using a special software. This is like "Modern times" in Charlie chaplin, you rank very fast. From memory, this guy would not spend more than one minute on each website. Google is very interested in communities, as this brings audience. So with OpenSC community, becoming #1 on Google should be easy. Also, Google does not like projects with several domains. You get a downscore. So you should ask for the old domain. But is is a minor issue IMHO. Kind regards, -- Jean-Michel Pouré - Gooze - http://www.gooze.eu |
From: Jean-Michel P. - G. <jm...@go...> - 2013-08-29 12:58:18
|
Le jeudi 29 août 2013 à 06:00 +0200, Anders Rundgren a écrit : > I think your conclusions regarding security are correct. > I.e. this is not a perfect solution. My next step was to test Android 4.3 in real life, which I did during the night, as I was too busy to play. I used a Nexus7 hardware with embedded crypto chip. The very same hardware which is described in the article. First of all, Android 4.3 has a strange option to become what is called "Administrator". When such option is triggered, you can connect on your Gmail account and disable your tablet remotely and reformat flash card. This indicated that under some conditions, Gmail and Google can be the administrator of your tablet and have total control remotely. This is the first time ever that I test such a feature on a computer. In movie Elysium: http://fr.wikipedia.org/wiki/Elysium Kruger (Sharlto Copley) certificates and authorizations are canceled remotely by Jessica Delacourt (Jodie Foster) interactively. In the movie, Kruger IS a war criminal, so this is normal. There are also very good shots about a Faraday cage, but this is not the issue here. Here, the issue is certificate management over the Internet. There is some kind of such mechanism in Nexus7, as it seems that all certificates can be canceled remotely using GMail. The scope of control is unknown: user only, Google itself, US government, or local government (France government for France, German government for Germany, etc ...). Sincerely, I have no idea. This seems normal for French government to disable a tablet of a French citizen in case of extreme emergency and this is not shocking IMHO. But other scopes are unknown. Under Nexus7, there is also this strange option for voice recognition, where the tablet can listen to conversations with or without Internet connection and display the text. I could test with very unusual sentences and it worked like a charm. The only error is that the tablet mixed "dog" with "cat", but it was clearly Okay. What does "Voice recognition" with Internet connection means? Simple: your voice is processed remotely in the cloud with power of thousands of CPUs. We know what it means. Together, the impact of: * embedded cryptography using unknown chips, * total control over certificates (probably through master key or some slave keys) using Internet, * total control over reboot and reformat of tablet, * AND voice recognition (in French we say this is "la cerise sur la gateau"), AND security leaks built in the system (i.e. leading to well-known exploits and backdoors) IS unknown. This is the least to say! For sure, Android 4.3 and Nexus7 are not usable in any kind of Company, University or and mainly not any kind of Government or any kind of Administration, local or central or any kind of association or charity. I am quite surprised, actually, did Google register the cryto chip at ANSSI (French administration for crypto), as it is requested? My Nexus7 tablet is now shut-down and I will probably not start it again, even to make screenshots. I am waiting for an upgrade of the Android system, which would allow businesses to use the tablet in decent conditions. Thank you again for this interesting article, which convinced me to avoid any management of certificates over Internet. So the future belongs to smartcards and USB tokens. We draw a different conclusion as yours. And this is still needed to register cryto-chips at ANSSI, France, for security and also freedom. Kind regards, -- Jean-Michel Pouré - Gooze - http://www.gooze.eu |
From: Ludovic R. <lud...@gm...> - 2013-08-29 08:08:43
|
2013/8/28 Douglas E. Engert <dee...@an...>: > We keep saying in responses to e-mails statements like: > "The project do not use opensc-project.org any more. > Read https://github.com/OpenSC/OpenSC/wiki/OpenSC-Services" > > But if an ordinary users Googles for OpenSC subjects > a reference to github may not even show up in the first 100 > responses. > > This continues to lead users to the old pages and the project > appears to be dead! > > For example Google for: > Getting started with OpenSC > shows https://www.opensc-project.org/opensc/wiki/GetStarted > Last updated 2 years ago. > > But Google with it in quotes: "Getting started with OpenSC" > and github is first. > https://github.com/OpenSC/OpenSC/wiki/Getting-started-with-OpenSC > Updated 8 months ago. > (Don't ask me why Google does this, it just does.) > > One way to help users find the up to date pages would be to add > to every page on the old > https://www.opensc-project.org/opensc/wiki > > some box saying the project has moved to github, > and the Wiki can be found at: > https://www.opensc-project.org/opensc/wiki I updated the wiki page above. I do not want to edit _every_ wiki pages at https://www.opensc-project.org/ That is too much work. Thanks for the reminder. Bye -- Dr. Ludovic Rousseau |
From: Anders R. <and...@gm...> - 2013-08-29 07:31:51
|
On 2013-08-29 09:26, Mat Arge wrote: > That's a really cool idea. > If you somehow wnat to have this adopted as an alternative to XML-DSIG and CMS > and ported to other languages, i think you should make a seperate project out > of it. Thanx Mat, Yes, I'm considering that. After porting KeyGen2 to JSON I will be ready with that. In the mean-time there's some more rationale here: https://openkeystore.googlecode.com/svn/resources/trunk/docs/Enveloped-JSON-Signatures.pdf Cheers Anders > > cheers > Mat > > On Wednesday 28. August 2013 18:06:43 Anders Rundgren wrote: >> Since Google doesn't support XSD or XML DSig in Android I began looking at >> other alternatives. There were none :-( Therefore I created a 2000-line >> system that writes and reads JSON from Java. In addition, I adopted a >> scaled-down version of XML DSig's enveloped-signatures. >> >> The concept of enveloped signatures have been slammed by some people due to >> a belief that canonicalization issues will be hard. FWIW, I just wrote the >> entire thing in just a week and I didn't find any problems all. >> >> https://code.google.com/p/openkeystore/source/browse/#svn%2Flibrary%2Ftrunk% >> 2Fsrc%2Forg%2Fwebpki%2Fjson >> >> It seems that I will be able to replace 200,000 lines of Apache code with >> about 2,000 lines of custom code. >> >> { >> "MyLittleSignature": >> { >> "Version": "http://example.com/signature", >> "Now": "2013-08-25T20:31:23+02:00", >> "HRT": >> { >> "RTl": "67", >> "YT": >> { >> "HTL": "656756#", >> "INTEGER": -689, >> "Fantastic": false >> }, >> "er": "33" >> }, >> "ARR": [], >> "BARR": >> [{ >> "HTL": "656756#", >> "INTEGER": -689, >> "Fantastic": true >> }, >> { >> "HTL": "656756#", >> "INTEGER": -689, >> "Fantastic": false >> }], >> "ID": "ihqQONXvN5_LnmdAG7YU", >> "STRINGS": ["One","Two","Three"], >> "Intra": 78, >> "EnvelopedSignature": >> { >> "SignatureInfo": >> { >> "Algorithm": >> "http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha256", "Reference": >> { >> "Name": "ID", >> "Value": "ihqQONXvN5_LnmdAG7YU" >> }, >> "KeyInfo": >> { >> "PublicKey": >> { >> "EC": >> { >> "NamedCurve": >> "http://xmlns.webpki.org/sks/algorithm#ec.p256", "X": >> "lNxNvAUEE8t7DSQBft93LVSXxKCiVjhbWWfyg023FCk", "Y": >> "LmTlQxXB3LgZrNLmhOfMaCnDizczC/RfQ6Kx8iNwfFA" } >> } >> } >> }, >> "SignatureValue": >> "MEUCIEhZtArhp8O7d1n7SRWRQcs3qePGBCrnKY8x2O3o+nvPAiEA0On5hez2EHmEwJIm/UK7Gx >> qZeWWcaFzK9OVAhygAWVk" } >> } >> } >> >> Why bother with this you may wonder? Well I can't imagine converting the >> previous cool stuff to something yucky like JOSE's JWS: >> >> { >> "message": >> "eyJ0eXAiOibGciOiJIUzI1NiJ9.LmNvbS9pc19yb290Ijp0cnVlfQ.2K27uhbUJU1p1r_wW1gF >> WFOEjXk" } >> >> Canonicalization (=removal of whitespace): >> >> "MyLittleSignature":{"Version":"http://example.com/signature","Now":"2013-08 >> -25T20:31:23+02:00","HRT":{"RTl":"67","YT":{"HTL":"656756#","INTEGER":-689," >> Fantastic":false},"er":"33"},"ARR":[],"BARR":[{"HTL":"656756#","INTEGER":-68 >> 9,"Fantastic":true},{"HTL":"656756#","INTEGER":-689,"Fantastic":false}],"ID" >> :"ihqQONXvN5_LnmdAG7YU","STRINGS":["One","Two","Three"],"Intra":78,"Envelope >> dSignature":{"SignatureInfo":{"Algorithm":"http://www.w3.org/2001/04/xmldsig >> -more#ecdsa-sha256","Reference":{"Name":"ID","Value":"ihqQONXvN5_LnmdAG7YU"} >> ,"KeyInfo":{"PublicKey":{"EC":{"NamedCurve":"http://xmlns.webpki.org/sks/alg >> orithm#ec.p256","X":"lNxNvAUEE8t7DSQBft93LVSXxKCiVjhbWWfyg023FCk"," >> Y":"LmTlQxXB3LgZrNLmhOfMaCnDizczC/RfQ6Kx8iNwfFA"}}}} >> >> Cheers, >> Anders >> >> >> ---------------------------------------------------------------------------- >> -- Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more! >> Discover the easy way to master current and previous Microsoft technologies >> and advance your career. Get an incredible 1,500+ hours of step-by-step >> tutorial videos with LearnDevNow. Subscribe today and save! >> http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk >> _______________________________________________ >> Opensc-devel mailing list >> Ope...@li... >> https://lists.sourceforge.net/lists/listinfo/opensc-devel > > > ------------------------------------------------------------------------------ > Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more! > Discover the easy way to master current and previous Microsoft technologies > and advance your career. Get an incredible 1,500+ hours of step-by-step > tutorial videos with LearnDevNow. Subscribe today and save! > http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk > _______________________________________________ > Opensc-devel mailing list > Ope...@li... > https://lists.sourceforge.net/lists/listinfo/opensc-devel > |