Hello,

the pkcs15init tool currently writes to cards, even when the profile
indication (3F00/5015/4946) isn't found. That's bad, because it's highly
possible that such a card was personalised with another library or has
an unknown profile. In my opinion there are the following issues:

1. opensc isn't smart enough to do such things (see #252)
2. after a successful write operation the TokenInfo is overridden, which
   * is incomplete and
   * contains broken ASN1 encoding

The attached patch prevents that behaviour and fixes #252. It is for
current trunk. But should work for 0.11.13 too.

Regards
Andre
Index: pkcs15init/pkcs15-lib.c
===================================================================
--- pkcs15init/pkcs15-lib.c	(revision 4851)
+++ pkcs15init/pkcs15-lib.c	(working copy)
@@ -3518,8 +3518,6 @@
 		if ((mem = malloc(len)) != NULL) {
 			r = sc_read_binary(card, 0, mem, len, 0);
 		}
-	} else {
-		r = 0;
 	}
 
 	if (r >= 0)
_______________________________________________
opensc-devel mailing list
opensc-devel@lists.opensc-project.org
http://www.opensc-project.org/mailman/listinfo/opensc-devel

Reply via email to