Moin, I have a PKCS#15 card (Starcos SPK 2.3) which I formatted with opensc quite some time ago (the certificate is dated September 2005). It now causes pkcs15-tool --list-pins to crash.
I traced the error to src/tools/pkcs15-tool.c line 891 (current svn). Apparently on this card the pin types are all set to -1 (the corresponding ASN.1 encoding is 0a 04 ff ff ff ff). Attached is a patch to make pkcs15-tool not crash. A quick grep through the sources shows that most other places handle pin types with switch constructs with default clauses so they should not be affected. -- Henryk Plötz Grüße aus Berlin ~~~~~~~ Un-CDs, nein danke! http://www.heise.de/ct/cd-register/ ~~~~~~~ ~ Help Microsoft fight software piracy: Give Linux to a friend today! ~
Index: src/tools/pkcs15-tool.c =================================================================== --- src/tools/pkcs15-tool.c (Revision 3000) +++ src/tools/pkcs15-tool.c (Arbeitskopie) @@ -888,7 +888,10 @@ pin->min_length, pin->max_length, pin->stored_length); printf("\tPad char : 0x%02X\n", pin->pad_char); printf("\tReference : %d\n", pin->reference); - printf("\tType : %s\n", pin_types[pin->type]); + if (pin->type >= 0 && pin->type < sizeof(pin_types)/sizeof(pin_types[0])) + printf("\tType : %s\n", pin_types[pin->type]); + else + printf("\tType : [encoding %d]\n", pin->type); printf("\tPath : %s\n", sc_print_path(&pin->path)); if (pin->tries_left >= 0) printf("\tTries left: %d\n", pin->tries_left);
pgpbNMIpSEOY2.pgp
Description: PGP signature
_______________________________________________ opensc-devel mailing list opensc-devel@lists.opensc-project.org http://www.opensc-project.org/mailman/listinfo/opensc-devel