[Pcsclite-cvs-commit] r363 - in trunk/muscleTool: . man win32

Karsten Ohme ohme-guest at costa.debian.org
Mon Jan 2 18:33:47 UTC 2006


Author: ohme-guest
Date: 2006-01-02 18:33:35 +0000 (Mon, 02 Jan 2006)
New Revision: 363

Modified:
   trunk/muscleTool/ChangeLog
   trunk/muscleTool/README
   trunk/muscleTool/help.c
   trunk/muscleTool/help.h
   trunk/muscleTool/man/muscleTool.1
   trunk/muscleTool/man/muscleTool.1.in
   trunk/muscleTool/muscleTool.c
   trunk/muscleTool/muscleTool.h
   trunk/muscleTool/parser.y
   trunk/muscleTool/scanner.l
   trunk/muscleTool/win32/MuscleTools.vcproj
Log:
Compilation error fixed
New GetStatus() for MuscleCard library 2.0.0 included
setstatus command
changeacl command
changekeyacl command 

Modified: trunk/muscleTool/ChangeLog
===================================================================
--- trunk/muscleTool/ChangeLog	2005-11-15 03:07:20 UTC (rev 362)
+++ trunk/muscleTool/ChangeLog	2006-01-02 18:33:35 UTC (rev 363)
@@ -1,5 +1,11 @@
 History
 =======
+2.1.0 - 02 Jan 2006, Karsten Ohme
+	- Compilation error fixed
+	- New GetStatus() for MuscleCard library 2.0.0 included
+	- setstatus command
+	- changeacl command
+	- changekeyacl command
 
 2.0.0 - 19 Oct 2005, Karsten Ohme
 	- genkeys can generate RSA, DSA, EC, RSA-CRT, AES and DES keys
@@ -8,14 +14,14 @@
 	- crypt can read from file and write output to file
 	- Included man page in Makefile.am
 	- improved autoconf checks
-	- support for version 2.0 of MuscleCard library, MuscleCard Plug-In, Card Edge 1.0.1
+	- support for version 2.0.0 of MuscleCard library, MuscleCard Plug-In, Card Edge 1.0.1
 	  - enter PIN with keypad
 	  - deletekey command
 	  - deleteid command
 	  - resume supports returns new capabilities
 	  - extended format command
 	  - movekey command
-	  - moveobject command
+	  - move command	  
 
 1.0.0 - Sa Aug 14 02:51:01 CEST 2004, Toni Andjelkovic
 	- autoconf/automake configuration

Modified: trunk/muscleTool/README
===================================================================
--- trunk/muscleTool/README	2005-11-15 03:07:20 UTC (rev 362)
+++ trunk/muscleTool/README	2006-01-02 18:33:35 UTC (rev 363)
@@ -19,8 +19,8 @@
 
 There are two versions depending of the compile switch VERSION2.
 If VERSION2 is defined some new features are enabled for which
-you need the new version 2.0 of the MuscleCard library, MuscleCard
-Plug-In and CardEdge Applet.
+you need the new version 2.0.0 of the MuscleCard library, MuscleCard
+Plug-In 2.0.0 and CardEdge Applet in protocol version 1.30.
 
 You can generate keys, list keys, import and export
 and use keys for cryptographic operations.
@@ -34,11 +34,11 @@
 With the new version, you can also delete keys.
 
 You can create, read, write object, delete and list objects.
-With the new version you can also rename objects.
+With the new version you can also rename objects and change the ACL for objects.
 
 You can create, list, change, unblock and verify and PINs.
 With the new version you can also delete IDs (PINs or keys).
-With the new version you can also renumber keys.
+With the new version you can also renumber keys and change their ACL.
 
 General commands are the status command, the connect and
 release command and maybe very informative the resume command,

Modified: trunk/muscleTool/help.c
===================================================================
--- trunk/muscleTool/help.c	2005-11-15 03:07:20 UTC (rev 362)
+++ trunk/muscleTool/help.c	2006-01-02 18:33:35 UTC (rev 363)
@@ -26,6 +26,7 @@
 	"     list          List objects on token",
 #ifdef VERSION2
 	"     moveobject    Moves an object",
+	"     changeacl     Change ACL of object",
 #endif
 	"",
 	"PIN related functions:",
@@ -48,6 +49,7 @@
 #ifdef VERSION2
 	"     deletekey     Deletes a key",
 	"     movekey       Moves a key",
+	"     changekeyacl  Change ACL of key",
 #endif
 	"     crypt         Perform a cipher operation on user input",
 	"     filecrypt     Perform a cipher operation on a file",
@@ -60,6 +62,9 @@
 	"     resume        Get the token capabilities",
 	"     release       Release a token",
 	"     status        Get the token status",
+#ifdef VERSION2
+	"     setstatus     Set token state",
+#endif
 	"     challenge     Get a random number",
 	"     logout        Log out AUT",
 	"     version       Print the program version",
@@ -111,6 +116,14 @@
 	NULL,
 };
 
+static char *help_changeacl_txt[] = {
+	"Changes the ACL of an object.",
+	"Usage: changeacl id",
+	"Arguments:",
+	"       id       object id (string)",
+	NULL,
+};
+
 static char *help_write_txt[] = {
 	"Write from file to object.",
 	"Usage: write file id",
@@ -185,6 +198,14 @@
 	NULL
 };
 
+static char *help_changekeyacl_txt[] = {
+	"Changes the ACL of a key.",
+	"Usage: changekeyacl keynum",
+	"Arguments:",
+	"    keynum      key number (num)",
+	NULL,
+};
+
 static char *help_exportkey_txt[] = {
 	"Export a key.",
 	"Usage: exportkey keynum path",
@@ -376,6 +397,12 @@
 	NULL
 };
 
+static char *help_setstatus_txt[] = {
+	"Set a token state.",
+	"Usage: setstatus",
+	NULL
+};
+
 static char *help_challenge_txt[] = {
 	"Get a random number.",
 	"Usage: challenge len",
@@ -454,6 +481,11 @@
 	print(help_read_txt);
 }
 
+void help_changeacl()
+{
+	print(help_changeacl_txt);
+}
+
 void help_list()
 {
 	print(help_list_txt);
@@ -494,6 +526,11 @@
 	print(help_listkeys_txt);
 }
 
+void help_changekeyacl()
+{
+	print(help_changekeyacl_txt);
+}
+
 void help_exportkey()
 {
 	print(help_exportkey_txt);
@@ -604,6 +641,11 @@
 	print(help_status_txt);
 }
 
+void help_setstatus()
+{
+	print(help_setstatus_txt);
+}
+
 void help_challenge()
 {
 	print(help_challenge_txt);

Modified: trunk/muscleTool/help.h
===================================================================
--- trunk/muscleTool/help.h	2005-11-15 03:07:20 UTC (rev 362)
+++ trunk/muscleTool/help.h	2006-01-02 18:33:35 UTC (rev 363)
@@ -18,6 +18,7 @@
 void help_read();
 void help_list();
 void help_move();
+void help_changeacl();
 
 void help_verify();
 void help_makepin();
@@ -26,6 +27,7 @@
 void help_listpins();
 void help_deleteid();
 void help_movekey();
+void help_changekeyacl();
 
 void help_listkeys();
 void help_exportkey();
@@ -53,6 +55,7 @@
 
 void help_release();
 void help_status();
+void help_setstatus();
 void help_challenge();
 void help_logout();
 void help_version();

Modified: trunk/muscleTool/man/muscleTool.1
===================================================================
--- trunk/muscleTool/man/muscleTool.1	2005-11-15 03:07:20 UTC (rev 362)
+++ trunk/muscleTool/man/muscleTool.1	2006-01-02 18:33:35 UTC (rev 363)
@@ -32,7 +32,7 @@
 .\" \fI<whatever>\fP escape sequences to invode bold face and italics,
 .\" respectively.
 \fBmuscletools\fP is a program that manage and personalize your
-MuscleCard smartcards.
+MuscleCard smart cards.
 .PP
 Supported commands are:
 .PP
@@ -50,10 +50,14 @@
 .I [file] [id]
 Write from file to object
 .IP
-.B  read
+.B read
 .I [id] [file]
 Read from object to file
 .IP
+.B move
+.I [id] [newid]
+Rename an object
+.IP
 .B list
 List objects on token
 .PP
@@ -75,9 +79,9 @@
 .I [pinnumber]
 Unblock a PIN
 .IP
-.B deletepin
-.I [pinnumber]
-Delete a PIN
+.B deleteid
+.I [IDnumber]
+Delete an ID
 .IP
 .B listpins
 List the PINs
@@ -103,7 +107,11 @@
 .I [keynumber]
 Delete a key
 .IP
-.B crypt
+.B movekey
+.I [keynumber] [newkeynumber]
+Renumbers a key
+.IP
+.B filecrypt
 .I [keynum] [infile] [outfile]
 Perform a cipher operation on infile and stores result in outfile
 .IP
@@ -132,6 +140,7 @@
  des       - Lists DES capabilities
  3des      - Lists 3DES capabilities
  aes       - Lists AES capabilities
+ ec        - Lists EC capabilities
  keys      - Lists Key capabilities
  pins      - Lists PIN capabilities
  objects   - Lists Object capabilities

Modified: trunk/muscleTool/man/muscleTool.1.in
===================================================================
--- trunk/muscleTool/man/muscleTool.1.in	2005-11-15 03:07:20 UTC (rev 362)
+++ trunk/muscleTool/man/muscleTool.1.in	2006-01-02 18:33:35 UTC (rev 363)
@@ -32,7 +32,7 @@
 .\" \fI<whatever>\fP escape sequences to invode bold face and italics,
 .\" respectively.
 \fBmuscletools\fP is a program that manage and personalize your
-MuscleCard smartcards.
+MuscleCard smart cards.
 .PP
 Supported commands are:
 .PP
@@ -50,10 +50,18 @@
 .I [file] [id]
 Write from file to object
 .IP
-.B  read
+.B read
 .I [id] [file]
 Read from object to file
 .IP
+.B move
+.I [id] [newid]
+Rename an object
+.IP
+.B changeacl
+.I [id]
+Change the ACL of an object
+.IP
 .B list
 List objects on token
 .PP
@@ -75,9 +83,9 @@
 .I [pinnumber]
 Unblock a PIN
 .IP
-.B deletepin
-.I [pinnumber]
-Delete a PIN
+.B deleteid
+.I [IDnumber]
+Delete an ID
 .IP
 .B listpins
 List the PINs
@@ -103,7 +111,15 @@
 .I [keynumber]
 Delete a key
 .IP
-.B crypt
+.B movekey
+.I [keynumber] [newkeynumber]
+Renumbers a key
+.IP
+.B changekeyacl
+.I [keynumber]
+Change the ACL of a key
+.IP
+.B filecrypt
 .I [keynum] [infile] [outfile]
 Perform a cipher operation on infile and stores result in outfile
 .IP
@@ -132,6 +148,7 @@
  des       - Lists DES capabilities
  3des      - Lists 3DES capabilities
  aes       - Lists AES capabilities
+ ec        - Lists EC capabilities
  keys      - Lists Key capabilities
  pins      - Lists PIN capabilities
  objects   - Lists Object capabilities

Modified: trunk/muscleTool/muscleTool.c
===================================================================
--- trunk/muscleTool/muscleTool.c	2005-11-15 03:07:20 UTC (rev 362)
+++ trunk/muscleTool/muscleTool.c	2006-01-02 18:33:35 UTC (rev 363)
@@ -51,9 +51,14 @@
 static int getStringValue(char *header, char *footer, char *stringValue, int stringValueLength);
 static int getNumberValue(char *header, char *footer, unsigned long *numberValue);
 static void doPrintAUT(MSCUShort16);
+#ifdef VERSION2
+static void doPrintOwner(MSCUShort16);
+void doPrintKeyFlags(MSCUShort16);
+#endif
 static void _8ByteTo4Short(MSCUChar8 byteArray[8], MSCUShort16 shortArray[4]);
 static MSCUShort16 getUShort16(MSCPUChar8 srcValue);
 static MSCULong32 getULong32(MSCPUChar8 srcValue);
+static void setUShort16(MSCPUChar8 destValue, MSCUShort16 srcValue);
 
 #define CHECK_ERR(cond, msg) { if (cond) { \
   printf("ERR: %s (0x%lX %s)\n", msg, rv, msc_error(rv)); goto end; } }
@@ -62,6 +67,10 @@
   printf("X\n"); } else { printf("\n"); } }
 
 
+static void setUShort16(MSCPUChar8 destValue, MSCUShort16 srcValue) {
+  destValue[0] = (srcValue & 0xFF00) >> 8;
+  destValue[1] = (srcValue & 0x00FF);
+}
 
 static void _8ByteTo4Short(MSCUChar8 byteArray[8], MSCUShort16 shortArray[4])
 {
@@ -71,12 +80,12 @@
 	shortArray[3] = getUShort16(byteArray+6);
 }
 
-static MSCUShort16 getUShort16(MSCPUChar8 srcValue) 
+static MSCUShort16 getUShort16(MSCPUChar8 srcValue)
 {
 	return (MSCUShort16)( ((srcValue[0]) << 8) | srcValue[1] );
 }
 
-static MSCULong32 getULong32(MSCPUChar8 srcValue) 
+static MSCULong32 getULong32(MSCPUChar8 srcValue)
 {
 	MSCULong32 temp;
 	temp  = srcValue[0] * 0x1000000;
@@ -226,7 +235,7 @@
 }
 
 /**
-* Pads data at the beginning with 0x01 and continues 0x00s so. 
+* Pads data at the beginning with 0x01 and continues 0x00s so.
 * If inSize == outSize the first byte is now allowed to be larger than
 * 0x80.
 * So the RSA modulus is smaller and the exponentiation exceeds modulus.
@@ -295,6 +304,180 @@
 #endif
 
 #ifdef VERSION2
+void doChangeACL(char *objectID) {
+	MSCLong32 rv = 0;
+	MSCObjectACL objectACL;
+	MSCULong32 readACL, writeACL, deleteACL;
+
+	CHECK_ERR(pConnection == 0, "Must Connect First !");
+
+	rv = getNumberValue("Enter the new ACL for reading the object", "Enter ACL mask", &readACL);
+	if (rv == 0)
+		goto abort;
+
+	rv = getNumberValue("Enter the new ACL for writing the object", "Enter ACL mask", &writeACL);
+	if (rv == 0)
+		goto abort;
+
+	rv = getNumberValue("Enter the new ACL for deleting the object", "Enter ACL mask", &deleteACL);
+	if (rv == 0)
+		goto abort;
+
+	objectACL.readPermission = (MSCUShort16)readACL;
+	objectACL.writePermission = (MSCUShort16)writeACL;
+	objectACL.deletePermission = (MSCUShort16)deleteACL;
+
+	rv = MSCChangeObjectACL(pConnection, (MSCString)objectID, &objectACL);
+	CHECK_ERR(rv != MSC_SUCCESS, "ChangeACL Failed !");
+	printf("ChangeACL Successful\n");
+abort:
+end:
+	return;
+}
+#else
+void doChangeACL(char *objectID) {
+  printf("Not supported. \n");
+}
+#endif
+
+#ifdef VERSION2
+void doChangeKeyACL(int key_nb) {
+	MSCLong32 rv = 0;
+	MSCKeyACL keyACL;
+	MSCULong32 readACL, writeACL, useACL;
+
+	CHECK_ERR(pConnection == 0, "Must Connect First !");
+
+	rv = getNumberValue("Enter the new ACL for reading the key", "Enter ACL mask", &readACL);
+	if (rv == 0)
+		goto abort;
+
+	rv = getNumberValue("Enter the new ACL for writing the key", "Enter ACL mask", &writeACL);
+	if (rv == 0)
+		goto abort;
+
+	rv = getNumberValue("Enter the new ACL for deleting the key", "Enter ACL mask", &useACL);
+	if (rv == 0)
+		goto abort;
+
+	keyACL.readPermission = (MSCUShort16)readACL;
+	keyACL.writePermission = (MSCUShort16)writeACL;
+	keyACL.usePermission = (MSCUShort16)useACL;
+
+	rv = MSCChangeKeyACL(pConnection, (MSCUChar8)key_nb, &keyACL);
+	CHECK_ERR(rv != MSC_SUCCESS, "ChangeACL Failed !");
+	printf("ChangeACL Successful\n");
+abort:
+end:
+	return;
+}
+#else
+void doChangeKeyACL(int key_nb) {
+  printf("Not supported. \n");
+}
+#endif
+
+#ifdef VERSION2
+void doSetStatus() {
+	MSCLong32 rv = 0;
+	MSCULong32 choice;
+	MSCULong32 dummy = 256;
+	MSCUChar8 temp[256];
+	char *choices[5] = {"Serial Number", "Card Label", "ID Creation ACL",
+	"Object Creation ACL", "Key Creation ACL"};
+
+	CHECK_ERR(pConnection == 0, "Must Connect First !");
+
+	choice = getChoice("What do you want to change?: ", "Choose", choices, 5);
+
+	switch (choice) {
+		case 0:
+			goto abort;
+		case 1:
+			rv = getStringValue(
+				"Please enter the serial number (exactly 16 chars, eventually padded with ' ')",
+				"Enter serial number",
+				temp,
+				MSC_SERIALNUMBER_SIZE+1
+			);
+			if (rv == 0)
+				goto abort;
+			rv = MSCSetStatus(pConnection, MSC_TAG_STATE_SERIAL_NUMBER, temp, 16);
+			if (rv == MSC_SERIAL_ERROR) {
+				printf("ERR: Serial Number already set.\n");
+				goto end;
+			}
+			else if (rv == MSC_UNSUPPORTED_FEATURE) {
+				printf("ERR: Serial Number not supported.\n");
+				goto end;
+			}
+			else {
+				CHECK_ERR(rv != MSC_SUCCESS, "SetState Failed !");
+			}
+			break;
+		case 2:
+			rv = getStringValue(
+				"Please enter the card label (exactly 32 chars, eventually padded with ' ')",
+				"Enter card label",
+				temp,
+				MSC_TOKENLABEL_SIZE+1
+			);
+			if (rv == 0)
+				goto abort;
+			rv = MSCSetStatus(pConnection, MSC_TAG_STATE_TOKEN_LABEL, temp, 32);
+			if (rv == MSC_LABEL_ERROR) {
+				printf("ERR: Card label already set.\n");
+				goto end;
+			}
+			else if (rv == MSC_UNSUPPORTED_FEATURE) {
+				printf("ERR: Card label not supported.\n");
+				goto end;
+			}
+			else {
+				CHECK_ERR(rv != MSC_SUCCESS, "SetState Failed !");
+			}
+			break;
+		case 3:
+			rv = getNumberValue("Enter the ACL for creating IDs\n", "Enter ACL mask", &dummy);
+			if (rv == 0)
+				goto abort;
+			setUShort16(temp, (MSCUShort16)dummy);
+			rv = MSCSetStatus(pConnection, MSC_TAG_STATE_ID_CREATION_ACL, temp, 2);
+			CHECK_ERR(rv != MSC_SUCCESS, "SetState Failed !");
+			break;
+		case 4:
+			rv = getNumberValue("Enter the ACL for creating objects\n", "Enter ACL mask", &dummy);
+			if (rv == 0)
+				goto abort;
+			setUShort16(temp, (MSCUShort16)dummy);
+			rv = MSCSetStatus(pConnection, MSC_TAG_STATE_OBJECT_CREATION_ACL, temp, 2);
+			CHECK_ERR(rv != MSC_SUCCESS, "SetState Failed !");
+			break;
+		case 5:
+			rv = getNumberValue("Enter the ACL for creating keys\n", "Enter ACL mask", &dummy);
+			if (rv == 0)
+				goto abort;
+			setUShort16(temp, (MSCUShort16)dummy);
+			rv = MSCSetStatus(pConnection, MSC_TAG_STATE_KEY_CREATION_ACL, temp, 2);
+			CHECK_ERR(rv != MSC_SUCCESS, "SetState Failed !");
+			break;
+		default:
+			break;
+	}
+	printf("SetStatus Successful\n");
+end:
+	return;
+abort:
+	printf("SetStatus Cancelled.\n");
+	return;
+}
+#else
+void doSetStatus() {
+  printf("Not supported. \n");
+}
+#endif
+
+#ifdef VERSION2
 void doDeleteID(int pin_nb) {
 	MSCLong32 rv = 0;
 
@@ -461,23 +644,23 @@
 	rv = MSCListObjects(pConnection, MSC_SEQUENCE_RESET, &objInfo);
 	CHECK_ERR((rv != MSC_SUCCESS && rv != MSC_SEQUENCE_END), "ListObjects Failed");
 
-	printf("%20s %12s\n", "Object ID", "Object Size");
-	printf("   -----------------  -----------\n");
+	printf("%16s %12s\n", "Object ID", "Object Size");
+	printf("%16s  %12s\n", "---------------", "-----------\n");
 
 	if (rv == MSC_SUCCESS)
 	{
-		printf("%20s   %10ld  ", objInfo.objectID, objInfo.objectSize);
+		printf("%16s   %10ld\n", objInfo.objectID, objInfo.objectSize);
 		printf("\n");
 		printf("            READ\n");
 		printf("       ---------\n");
 		doPrintAUT(objInfo.objectACL.readPermission),
 		printf("\n");
 		printf("           WRITE\n");
-		printf(" ---------------\n");
+		printf("       ---------\n");
 		doPrintAUT(objInfo.objectACL.writePermission),
 		printf("\n");
 		printf("          DELETE\n");
-		printf(" ---------------\n");
+		printf("       ---------\n");
 		doPrintAUT(objInfo.objectACL.deletePermission);
 		printf("\n");
 	}
@@ -492,18 +675,18 @@
 		CHECK_ERR((rv != MSC_SUCCESS && rv != MSC_SEQUENCE_END), "ListObjects Failed");
 		if (rv == MSC_SUCCESS)
 		{
-			printf("%20s   %10ld  ", objInfo.objectID, objInfo.objectSize);
+			printf("%16s   %10ld\n", objInfo.objectID, objInfo.objectSize);
 			printf("\n");
 			printf("            READ\n");
 			printf("       ---------\n");
 			doPrintAUT(objInfo.objectACL.readPermission),
 			printf("\n");
 			printf("           WRITE\n");
-			printf(" ---------------\n");
+			printf("       ---------\n");
 			doPrintAUT(objInfo.objectACL.writePermission),
 			printf("\n");
 			printf("          DELETE\n");
-			printf(" ---------------\n");
+			printf("       ---------\n");
 			doPrintAUT(objInfo.objectACL.deletePermission);
 			printf("\n");
 		}
@@ -646,20 +829,25 @@
  * \param flags The key flags.
  */
 void doPrintKeyFlags(MSCUShort16 flags) {
-	if (flags & MSC_KEY_CARD_GENERATED)
-	{
-		printf("%s\n", "Key is generated on card.");
-		return;
+	switch (flags) {
+		case MSC_KEY_TOKEN_GENERATED:
+			printf("%s\n", "Key is generated on card.");
+			break;
+		case MSC_KEY_NEVER_READABLE:
+			printf("%s\n", "Key is never readable (exportable).");
+			break;
+		case MSC_KEY_NEVER_WRITABLE:
+			printf("%s\n", "Key is never writable (but the admin can delete it).");
+			break;
+		default:
+			printf("%s%02X\n", "Unknown flag(s): ", flags);
+			break;
 	}
-	else {
-		printf("%s%02X\n", "Unknown flag(s): ", flags);
-		return;
-	}
 }
 #endif
 
 /**
- * Prints the need authentications
+ * Prints the needed authentications
  * \param aut The authentication mask.
  */
 static void doPrintAUT(MSCUShort16 aut)
@@ -690,13 +878,13 @@
 	if (aut & MSC_AUT_PIN_4)
 		printf("%16s\n", "PIN #4");
 
-	if (aut & 0x0020)
+	if (aut & MSC_AUT_PIN_5)
 		printf("%16s\n", "PIN #5");
 
-	if (aut & 0x0040)
+	if (aut & MSC_AUT_PIN_6)
 		printf("%16s\n", "PIN #6");
 
-	if (aut & 0x0080)
+	if (aut & MSC_AUT_PIN_7)
 		printf("%16s\n", "PIN #7");
 
 	if (aut & MSC_AUT_KEY_0)
@@ -718,7 +906,60 @@
 		printf("%16s\n", "KEY #5");
 }
 
-void doLoggedID(MSCULong32 aut)
+
+#ifdef VERSION2
+void doPrintOwner(MSCUShort16 owner) {
+	if (owner == MSC_AUT_NONE)
+	{
+		printf("NONE");
+		return;
+	}
+
+	if (owner & MSC_AUT_PIN_0)
+		printf("PIN #0 ");
+
+	if (owner & MSC_AUT_PIN_1)
+		printf("PIN #1 ");
+
+	if (owner & MSC_AUT_PIN_2)
+		printf("PIN #2 ");
+
+	if (owner & MSC_AUT_PIN_3)
+		printf("PIN #3 ");
+
+	if (owner & MSC_AUT_PIN_4)
+		printf("PIN #4 ");
+
+	if (owner & MSC_AUT_PIN_5)
+		printf("PIN #5");
+
+	if (owner & MSC_AUT_PIN_6)
+		printf("PIN #6");
+
+	if (owner & MSC_AUT_PIN_7)
+		printf("PIN #7");
+
+	if (owner & MSC_AUT_KEY_0)
+		printf("KEY #0 ");
+
+	if (owner & MSC_AUT_KEY_1)
+		printf("KEY #1 ");
+
+	if (owner & MSC_AUT_KEY_2)
+		printf("KEY #2 ");
+
+	if (owner & MSC_AUT_KEY_3)
+		printf("KEY #3 ");
+
+	if (owner & MSC_AUT_KEY_4)
+		printf("KEY #4 ");
+
+	if (owner & MSC_AUT_KEY_5)
+		printf("KEY #5 ");
+}
+#endif
+
+void doLoggedID(MSCUShort16 aut)
 {
 	if (aut == 0)
 	{
@@ -741,6 +982,15 @@
 	if (aut & MSC_AUT_PIN_4)
 		printf("PIN #4 ");
 
+	if (aut & MSC_AUT_PIN_5)
+		printf("PIN #5 ");
+
+	if (aut & MSC_AUT_PIN_6)
+		printf("PIN #6 ");
+
+	if (aut & MSC_AUT_PIN_7)
+		printf("PIN #7 ");
+
 	if (aut & MSC_AUT_KEY_0)
 		printf("KEY #0 ");
 
@@ -764,10 +1014,10 @@
 {
 	MSCLong32 rv = 0;
 #ifdef VERSION2
-	MSCULong32 dummy = 8;
-	MSCUChar8 temp[8];
+	MSCULong32 dummy = 256;
+	MSCUChar8 temp[256];
 #else
-        MSCStatusInfo pStatusStruct;
+    MSCStatusInfo pStatusStruct;
 #endif
 
 	CHECK_ERR(pConnection == 0, "Must Connect First !");
@@ -776,58 +1026,106 @@
 	dummy = 8;
 	rv = MSCGetStatus(pConnection, MSC_TAG_STATE_PROTO_VERSION, temp, &dummy);
 	CHECK_ERR(rv != MSC_SUCCESS, "GetState Failed !");
-	printf(" Protocol Version: %d.%d\n", temp[0], temp[1]);
+	printf("      Protocol Version: %d.%d\n", temp[0], temp[1]);
 
 	dummy = 8;
 	rv = MSCGetStatus(pConnection, MSC_TAG_STATE_APPLET_VERSION, temp, &dummy);
 	CHECK_ERR(rv != MSC_SUCCESS, "GetState Failed !");
-	printf(" Software Version: %d.%d\n", temp[0], temp[1]);
+	printf("      Software Version: %d.%d\n", temp[0], temp[1]);
 
 	dummy = 8;
 	rv = MSCGetStatus(pConnection, MSC_TAG_STATE_FREE_MEM, temp, &dummy);
 	CHECK_ERR(rv != MSC_SUCCESS, "GetState Failed !");
 
 	dummy = (temp[0] << 24) | (temp[1] << 16) | (temp[2] << 8) | temp[3];
-	printf("      Free Memory: %ld\n", dummy);
+	printf("           Free Memory: %ld\n", dummy);
 
 	dummy = 8;
 	rv = MSCGetStatus(pConnection, MSC_TAG_STATE_TOTAL_MEM, temp, &dummy);
 	CHECK_ERR(rv != MSC_SUCCESS, "GetState Failed !");
 	dummy = (temp[0] << 24) | (temp[1] << 16) | (temp[2] << 8) | temp[3];
-	printf("     Total Memory: %ld\n", dummy);
+	printf("          Total Memory: %ld\n", dummy);
 
 	dummy = 8;
 	rv = MSCGetStatus(pConnection, MSC_TAG_STATE_USED_PINS, temp, &dummy);
 	CHECK_ERR(rv != MSC_SUCCESS, "GetState Failed !");
-	printf("        PINs Used: %d\n", temp[0]);
+	printf("             PINs Used: %d\n", temp[0]);
 
 	dummy = 8;
 	rv = MSCGetStatus(pConnection, MSC_TAG_STATE_USED_KEYS, temp, &dummy);
 	CHECK_ERR(rv != MSC_SUCCESS, "GetState Failed !");
-	printf("        Keys Used: %d\n", temp[0]);
+	printf("             Keys Used: %d\n", temp[0]);
 
 	dummy = 8;
 	rv = MSCGetStatus(pConnection, MSC_TAG_STATE_LOGGED_IDS, temp, &dummy);
 	CHECK_ERR(rv != MSC_SUCCESS, "GetState Failed !");
-	printf("       Logged IDs: ");
-	doLoggedID((MSCUShort16)*temp);
+	printf("            Logged IDs: ");
+	doLoggedID(getUShort16(temp));
+	printf("\n");
+
+	dummy = 8;
+	rv = MSCGetStatus(pConnection, MSC_TAG_STATE_ID_CREATION_ACL, temp, &dummy);
+	CHECK_ERR(rv != MSC_SUCCESS, "GetState Failed !");
+	printf("    How can create IDs: \n");
+	doPrintAUT(getUShort16(temp));
+
+	dummy = 8;
+	rv = MSCGetStatus(pConnection, MSC_TAG_STATE_OBJECT_CREATION_ACL, temp, &dummy);
+	CHECK_ERR(rv != MSC_SUCCESS, "GetState Failed !");
+	printf("How can create objects: \n");
+	doPrintAUT(getUShort16(temp));
+
+	dummy = 8;
+	rv = MSCGetStatus(pConnection, MSC_TAG_STATE_KEY_CREATION_ACL, temp, &dummy);
+	CHECK_ERR(rv != MSC_SUCCESS, "GetState Failed !");
+	printf("   How can create keys: \n");
+	doPrintAUT(getUShort16(temp));
+
+	dummy = 32;
+	rv = MSCGetStatus(pConnection, MSC_TAG_STATE_TOKEN_LABEL, temp, &dummy);
+	if (rv == MSC_LABEL_ERROR) {
+		printf("            Card Label: Not set.\n");
+	}
+	else if (rv == MSC_UNSUPPORTED_FEATURE) {
+		printf("            Card Label: Not supported.\n");
+	}
+	else {
+		CHECK_ERR(rv != MSC_SUCCESS, "GetState Failed !");
+		temp[32] = '\0';
+		printf("            Card Label: %s\n", temp);
+	}
+
+	dummy = 16;
+	rv = MSCGetStatus(pConnection, MSC_TAG_STATE_SERIAL_NUMBER, temp, &dummy);
+	if (rv == MSC_SERIAL_ERROR) {
+		printf("         Serial Number: Not set.\n");
+	}
+	else if (rv == MSC_UNSUPPORTED_FEATURE) {
+		printf("         Serial Number: Not supported.\n");
+	}
+	else {
+		CHECK_ERR(rv != MSC_SUCCESS, "GetState Failed !");
+		temp[16] = '\0';
+		printf("         Serial Number: %s\n", temp);
+	}
+
 #else
-        rv = MSCGetStatus(pConnection, &pStatusStruct);
-        CHECK_ERR(rv != MSC_SUCCESS, "GetState Failed !");
+    rv = MSCGetStatus(pConnection, &pStatusStruct);
+    CHECK_ERR(rv != MSC_SUCCESS, "GetState Failed !");
 
-        printf(" Protocol Version: %d.%d\n", (pStatusStruct.appVersion>>8) & 0xFF, 
-               (pStatusStruct.appVersion & 0x00FF));
-        printf(" Software Version: %d.%d\n", (pStatusStruct.swVersion>>8) & 0xFF, 
-               (pStatusStruct.swVersion & 0x00FF));
-        printf("      Free Memory: %ld\n", pStatusStruct.freeMemory);
-        printf("     Total Memory: %ld\n", pStatusStruct.totalMemory);
-        printf("        PINs Used: %d\n", pStatusStruct.usedPINs);
-        printf("        Keys Used: %d\n", pStatusStruct.usedKeys);
-        printf("       Logged IDs: ");
-        doLoggedID(pStatusStruct.loggedID);
+    printf(" Protocol Version: %d.%d\n", (pStatusStruct.appVersion>>8) & 0xFF,
+            (pStatusStruct.appVersion & 0x00FF));
+    printf(" Software Version: %d.%d\n", (pStatusStruct.swVersion>>8) & 0xFF,
+            (pStatusStruct.swVersion & 0x00FF));
+    printf("      Free Memory: %ld\n", pStatusStruct.freeMemory);
+    printf("     Total Memory: %ld\n", pStatusStruct.totalMemory);
+    printf("        PINs Used: %d\n", pStatusStruct.usedPINs);
+    printf("        Keys Used: %d\n", pStatusStruct.usedKeys);
+    printf("       Logged IDs: ");
+    doLoggedID(pStatusStruct.loggedID);
+	printf("\n");
 #endif
-
-	printf("\n");
+	printf("GetStatus Successful\n");
 end:
 	return;
 }
@@ -871,7 +1169,7 @@
 			PRINT_SUPPORT(usValue & MSC_SUPPORT_AES);
 			printf("EC                     ");
 			PRINT_SUPPORT(usValue & MSC_SUPPORT_ECURVE);
-			return;
+			goto success;
 		}
 		else if (strcmp(type, "rsa") == 0)
 		{
@@ -997,7 +1295,7 @@
 				PRINT_SUPPORT(usValue &
 					MSC_CAPABLE_CIPHER_RSA_PKCS1_OAEP);
 			}
-			return;
+			goto success;
 		}
 		else if (strcmp(type, "dsa") == 0)
 		{
@@ -1048,7 +1346,7 @@
 				PRINT_SUPPORT(usValue &
 					MSC_CAPABLE_SIGNATURE_ECDSA_SHA);
 			}
-			return;
+			goto success;
 		}
 		else if (strcmp(type, "ec") == 0)
 		{
@@ -1129,7 +1427,7 @@
 				PRINT_SUPPORT(usValue &
 					MSC_CAPABLE_SIGNATURE_ECDSA_SHA);
 			}
-			return;
+			goto success;
 		}
 		else if (strcmp(type, "aes") == 0)
 		{
@@ -1174,7 +1472,7 @@
 			PRINT_SUPPORT(usValue &
 				MSC_CAPABLE_CIPHER_AES_BLOCK_128_ECB_NOPAD);
 			}
-			return;
+			goto success;
 		}
 		else if ((strcmp(type, "des") == 0) ||(strcmp(type, "3des") == 0))
 		{
@@ -1264,7 +1562,7 @@
 			PRINT_SUPPORT(usValue &
 				MSC_CAPABLE_CIPHER_DES_ECB_PKCS5)
 			}
-			return;
+			goto success;
 		}
 		else if (strcmp(type, "keys") == 0)
 		{
@@ -1280,7 +1578,7 @@
 			doPrintAUT(usValue);
 			printf("\n");
 
-			return;
+			goto success;
 		}
 		else if (strcmp(type, "pins") == 0)
 		{
@@ -1297,6 +1595,7 @@
 
 			printf("%03d\n", ucValue);
 
+			retLength = 8;
 			ucValue = 0;
 			printf("Minimum PIN size         ");
 			rv = MSCGetCapabilities(pConnection, MSC_TAG_CAPABLE_PIN_MINSIZE,
@@ -1305,6 +1604,7 @@
 
 			printf("%03d\n", ucValue);
 
+			retLength = 8;
 			ucValue = 0;
 			printf("Maximum number of PINs   ");
 			rv = MSCGetCapabilities(pConnection, MSC_TAG_CAPABLE_PIN_MAXNUM,
@@ -1313,6 +1613,7 @@
 
 			printf("%03d\n", ucValue);
 
+			retLength = 8;
 			ucValue = 0;
 			printf("Unblock PIN resets PIN   ");
 			rv = MSCGetCapabilities(pConnection, MSC_TAG_CAPABLE_PIN_ATTR,
@@ -1330,6 +1631,7 @@
 			else
 				printf(" NO\n");
 
+			retLength = 8;
 			printf("AUT needed to create pins:\n    ");
 			rv = MSCGetCapabilities(pConnection, MSC_TAG_CAPABLE_PIN_AUTH,
 				temp, &retLength);
@@ -1338,7 +1640,7 @@
 			doPrintAUT(usValue);
 			printf("\n");
 
-			return;
+			goto success;
 		}
 		else if (strcmp(type, "objects") == 0)
 		{
@@ -1356,18 +1658,16 @@
 
 			printf("%03d\n", ucValue);
 
-			ucValue = 0;
+			retLength = 8;
 			printf("Maximum number objects   ");
 			rv = MSCGetCapabilities(pConnection, MSC_TAG_CAPABLE_OBJ_MAXNUM,
-				(MSCPUChar8) & ucValue, &retLength);
-			if (rv != MSC_SUCCESS)
-			{
-				printf("\nERR: Getting attribute TAG_CAPABLE_OBJ_MAXNUM !\n");
-				return;
-			}
+				temp, &retLength);
+			CHECK_ERR(rv != MSC_SUCCESS, "Getting attribute TAG_CAPABLE_OBJ_AUTH");
+			usValue = getUShort16(temp);
 
-			printf("%03ld\n", ucValue);
+			printf("%03ld\n", usValue);
 
+			retLength = 8;
 			printf("AUT needed to create objects:\n    ");
 			rv = MSCGetCapabilities(pConnection, MSC_TAG_CAPABLE_OBJ_AUTH,
 				temp, &retLength);
@@ -1376,7 +1676,7 @@
 			doPrintAUT(usValue);
 			printf("\n");
 
-			return;
+			goto success;
 		}
 	}
 #else
@@ -1416,7 +1716,7 @@
 			PRINT_SUPPORT(ulValue & MSC_SUPPORT_SHA1);
 			printf("MD5                    ");
 			PRINT_SUPPORT(ulValue & MSC_SUPPORT_MD5);
-			return;
+			goto success;
 		}
 		else if (strcmp(type, "rsa") == 0)
 		{
@@ -1444,11 +1744,11 @@
 			PRINT_SUPPORT(ulValue & MSC_CAPABLE_RSA_NOPAD);
 			printf("PKCS#1 Padding         ");
 			PRINT_SUPPORT(ulValue & MSC_CAPABLE_RSA_PKCS1);
-			return;
+			goto success;
 		}
 		else if (strcmp(type, "aes") == 0) {
 			printf("Not supported in this MuscleTool version.\n");
-			return;
+			goto success;
 		}
 		else if (strcmp(type, "dsa") == 0)
 		{
@@ -1472,7 +1772,7 @@
 			PRINT_SUPPORT(ulValue & MSC_CAPABLE_DSA_4096);
 			printf("Key Generation         ");
 			PRINT_SUPPORT(ulValue & MSC_CAPABLE_DSA_KEYGEN);
-			return;
+			goto success;
 		}
 		else if (strcmp(type, "des") == 0)
 		{
@@ -1490,7 +1790,7 @@
 			PRINT_SUPPORT(ulValue & MSC_CAPABLE_DES_ECB);
 			printf("Key Generation         ");
 			PRINT_SUPPORT(ulValue & MSC_CAPABLE_DES_KEYGEN);
-			return;
+			goto success;
 		}
 		else if (strcmp(type, "3des") == 0)
 		{
@@ -1510,7 +1810,7 @@
 			PRINT_SUPPORT(ulValue & MSC_CAPABLE_3DES_3KEY);
 			printf("Key Generation         ");
 			PRINT_SUPPORT(ulValue & MSC_CAPABLE_3DES_KEYGEN);
-			return;
+			goto success;
 		}
 		else if (strcmp(type, "keys") == 0)
 		{
@@ -1525,7 +1825,7 @@
 			doPrintAUT(usValue);
 			printf("\n");
 
-			return;
+			goto success;
 		}
 		else if (strcmp(type, "pins") == 0)
 		{
@@ -1581,13 +1881,13 @@
 			retLength = 8;
 			rv = MSCGetCapabilities(pConnection, MSC_TAG_CAPABLE_PIN_AUTH,
 				temp, &retLength);
-			
+
 			CHECK_ERR(rv != MSC_SUCCESS, "Getting attribute TAG_CAPABLE_PIN_AUTH");
 			usValue = getUShort16(temp);
 			doPrintAUT(usValue);
 			printf("\n");
 
-			return;
+			goto success;
 		}
 		else if (strcmp(type, "objects") == 0)
 		{
@@ -1616,13 +1916,13 @@
 			retLength = 8;
 			rv = MSCGetCapabilities(pConnection, MSC_TAG_CAPABLE_OBJ_AUTH,
 				temp, &retLength);
-			
+
 			CHECK_ERR(rv != MSC_SUCCESS, "Getting attribute TAG_CAPABLE_OBJ_AUTH");
 			usValue = getUShort16(temp);
 			doPrintAUT(usValue);
 			printf("\n");
 
-			return;
+			goto success;
 		}
 	}
 
@@ -1643,6 +1943,8 @@
 		PRINT_SUPPORT(capability[MSC_SUPPORTED_FUNCTIONS_OFFSET_KEY_USE_AND_MANAGEMENT] & MSC_SUPPORT_IMPORTKEY);
 		printf("MSCMoveKey               ");
 		PRINT_SUPPORT(capability[MSC_SUPPORTED_FUNCTIONS_OFFSET_KEY_USE_AND_MANAGEMENT] & MSC_SUPPORT_MOVEKEY);
+		printf("MSCChangeKeyACL          ");
+		PRINT_SUPPORT(capability[MSC_SUPPORTED_FUNCTIONS_OFFSET_KEY_USE_AND_MANAGEMENT] & MSC_SUPPORT_CHANGE_KEY_ACL);
 		printf("MSCExportKey             ");
 		PRINT_SUPPORT(capability[MSC_SUPPORTED_FUNCTIONS_OFFSET_KEY_USE_AND_MANAGEMENT] & MSC_SUPPORT_EXPORTKEY);
 		printf("MSCComputeCrypt          ");
@@ -1675,6 +1977,8 @@
 		PRINT_SUPPORT(capability[MSC_SUPPORTED_FUNCTIONS_OFFSET_OBJECT_USE_AND_MANGEMENT] & MSC_SUPPORT_LISTOBJECTS);
 		printf("MSCMoveObject            ");
 		PRINT_SUPPORT(capability[MSC_SUPPORTED_FUNCTIONS_OFFSET_OBJECT_USE_AND_MANGEMENT] & MSC_SUPPORT_MOVEOBJECT);
+		printf("MSCChangeObjectACL       ");
+		PRINT_SUPPORT(capability[MSC_SUPPORTED_FUNCTIONS_OFFSET_OBJECT_USE_AND_MANGEMENT] & MSC_SUPPORT_CHANGE_OBJECT_ACL);
 		printf("MSCCreateObject          ");
 		PRINT_SUPPORT(capability[MSC_SUPPORTED_FUNCTIONS_OFFSET_OBJECT_USE_AND_MANGEMENT] & MSC_SUPPORT_CREATEOBJECT);
 		printf("MSCDeleteObject          ");
@@ -1687,6 +1991,8 @@
 		PRINT_SUPPORT(capability[MSC_SUPPORTED_FUNCTIONS_OFFSET_STATUS] & MSC_SUPPORT_GETCAPABILITIES);
 		printf("MSCGetState              ");
 		PRINT_SUPPORT(capability[MSC_SUPPORTED_FUNCTIONS_OFFSET_STATUS] & MSC_SUPPORT_GETSTATUS);
+		printf("MSCSetState              ");
+		PRINT_SUPPORT(capability[MSC_SUPPORTED_FUNCTIONS_OFFSET_STATUS] & MSC_SUPPORT_SETSTATUS);
 #else
 	retLength = 8;
 	rv = MSCGetCapabilities(pConnection, MSC_TAG_SUPPORT_FUNCTIONS,
@@ -1734,7 +2040,8 @@
 #endif
         }
 
-
+success:
+	printf("GetCapabilities Successful\n");
 end:
 	return;
 }
@@ -1758,7 +2065,7 @@
 	{
 		printf("ERR: Logout Failed !\n");
 	}
-	printf("Logout Successful.\n");
+	printf("Logout Successful\n");
 end:
 	return;
 }
@@ -1820,7 +2127,7 @@
 			NULL, 0);
 	}
 	else {
-          rv = getStringValue("Enter PIN", "Enter PIN", (char *)pinData, 17);
+        rv = getStringValue("Enter PIN", "Enter PIN", (char *)pinData, 17);
 		if (rv == 0)
 			goto abort;
 
@@ -1979,9 +2286,9 @@
                 rv = getStringValue(dummyString, "Enter PIN", (char *)newPinData, 17);
 		if (rv == 0)
 			goto abort;
-		
+
                 newPinSize = strlen((char *)newPinData);
-		
+
 		rv = MSCChangePIN(pConnection, (MSCUChar8) pinNumber,
 			(MSCUChar8 *) pinData, (MSCUChar8)pinSize, (MSCUChar8 *) newPinData, (MSCUChar8)newPinSize);
 	}
@@ -2054,7 +2361,7 @@
 
 	CHECK_ERR(pConnection == 0, "Must Connect First !");
 
-	rv = MSCDeleteObject(pConnection, objectID, MSC_ZF_DEFAULT);
+	rv = MSCDeleteObject(pConnection, objectID);
 	CHECK_ERR(rv != MSC_SUCCESS, "DeleteObject Failed !");
 	printf("DeleteObject Successful\n");
 end:
@@ -2388,7 +2695,7 @@
 		case MSC_KEY_3DES:
 		case MSC_KEY_3DES3:
 		case MSC_KEY_DES:
-#ifdef VERSION2	
+#ifdef VERSION2
         case MSC_KEY_AES:
 #endif
 #ifdef VERSION2
@@ -2421,7 +2728,7 @@
 			}
 #endif
 			break;
-#ifdef VERSION2	
+#ifdef VERSION2
 		case MSC_KEY_EC_F2M_PRIVATE:
 		case MSC_KEY_EC_FP_PRIVATE:
 #endif
@@ -2434,7 +2741,7 @@
 				default: goto abort;
 			}
 			break;
-#ifdef VERSION2	
+#ifdef VERSION2
 		case MSC_KEY_EC_F2M_PUBLIC:
 		case MSC_KEY_EC_FP_PUBLIC:
 #endif
@@ -2797,7 +3104,7 @@
 					}
 					break;
 #endif
-#ifdef VERSION2	
+#ifdef VERSION2
 				case MSC_KEY_EC_F2M_PRIVATE:
 				case MSC_KEY_EC_FP_PRIVATE:
 				case MSC_KEY_EC_FP_PUBLIC:
@@ -3085,7 +3392,7 @@
 	CHECK_ERR(pConnection == 0, "Must Connect First !");
 
 	printf("\n");
-	
+
 	keySize = sizeof(keyData);
 
 	rv = MSCExportKey(pConnection, (MSCUChar8) keyNumber,
@@ -3293,11 +3600,21 @@
 		if (rv == 0)
 			goto abort;
 
+#ifdef VERSION2
+		rv = getNumberValue("Enter the ACL for using the public key\nExample: 0xFFFF for all users", "Enter ACL mask", &pubUseACL);
+#else
 		rv = getNumberValue("Enter the ACL for using the public key\nExample: 0x0000 for all users", "Enter ACL mask", &pubUseACL);
+#endif
+
 		if (rv == 0)
 			goto abort;
 
+#ifdef VERSION2
+		rv = getNumberValue("Enter the ACL for reading the private key\nExample: 0x0000 for nobody", "Enter ACL mask", &prvReadACL);
+#else
 		rv = getNumberValue("Enter the ACL for reading the private key\nExample: 0xFFFF for nobody", "Enter ACL mask", &prvReadACL);
+#endif
+
 		if (rv == 0)
 			goto abort;
 
@@ -3314,7 +3631,12 @@
 		if (rv == 0)
 			goto abort;
 
+#ifdef VERSION2
 		rv = getNumberValue("Enter the ACL for reading the secret key\nExample: 0x0000 for nobody", "Enter ACL mask", (unsigned long *)&pubReadACL);
+#else
+		rv = getNumberValue("Enter the ACL for reading the secret key\nExample: 0xFFFF for nobody", "Enter ACL mask", (unsigned long *)&pubReadACL);
+#endif
+
 		if (rv == 0)
 			goto abort;
 
@@ -3423,6 +3745,10 @@
 	MSCUChar8 pinPolicies = 0;
 	MSCUChar8 pinMixType = 0;
 	MSCUChar8 pinCharset = 0;
+	MSCUChar8 setSerialNumber = 0;
+	MSCUChar8 serialNumber[MSC_SERIALNUMBER_SIZE+1];
+	MSCUChar8 setCardLabel = 0;
+	MSCUChar8 cardLabel[MSC_TOKENLABEL_SIZE+1];
 #endif
 
 	CHECK_ERR(tokenList == 0, "List Tokens First !");
@@ -3611,7 +3937,7 @@
 
 	printf("\n");
 
-	rv = getNumberValue("How much bytes for object memory would you like to allocate ?\nExample: 7096\n", "Enter object memory size", &memoryAlloc);
+	rv = getNumberValue("How much bytes for object memory would you like to allocate ?\nExample: 10000\n", "Enter object memory size", &memoryAlloc);
 	if (rv == 0)
 		goto abort;
 
@@ -3637,7 +3963,53 @@
 	rv = getNumberValue("Enter the ACL who can create PINs\nExample: 0x0001 for admin with PIN #0\n", "Enter ACL", &pinACL);
 	if (rv == 0)
 		goto abort;
+#ifdef VERSION2
+	/* Matheus: added card label and serial number information */
+	{
+		char *choices[2] = { "YES", "NO" };
+		rv = getChoice(
+					"Do you want to set the card label?\nCard label can be (re)set later by admin.\n",
+					"Choose:",
+					choices, 2);
 
+		if (rv == 1){
+			setCardLabel = 1;
+			// enter label
+			rv = getStringValue(
+				"Please enter the card label (exactly 32 chars, eventually padded with ' ')",
+				"Enter card label",
+				cardLabel,
+				MSC_TOKENLABEL_SIZE+1
+			);
+		}
+
+		if (rv == 0){
+			goto abort;
+		}
+
+		rv = getChoice(
+					"Do you want to set the card serial number?\nSerial number is a write once attribute, and if not set now can only be set later by card admin.\n",
+					"Choose",
+					choices, 2);
+
+		if (rv == 1){
+			setSerialNumber = 1;
+			// enter snumber
+			rv = getStringValue(
+				"Please enter the card serial number (exactly 16 chars, eventually padded with ' ')",
+				"Enter serial number",
+				serialNumber,
+				MSC_SERIALNUMBER_SIZE+1
+			);
+		}
+
+		if (rv == 0){
+			goto abort;
+		}
+		printf("\n");
+	}
+#endif
+
 	printf("Transport key       : %s\n", transportKey);
 #ifdef VERSION2
 	printf("Admin PIN           : %s (%d tries)\n", adminPIN, adminPINTries);
@@ -3685,7 +4057,13 @@
 				printf("    PIN must contain other character\n");
 		}
 	}
-	printf("\n");
+	if (setCardLabel) {
+		printf("Card label          : %s\n", cardLabel);
+	}
+	if (setSerialNumber) {
+		printf("Serial number       : %s\n", serialNumber);
+	}
+
 #endif
 	{
 		char *choices[2] = {"YES", "NO"};
@@ -3737,6 +4115,10 @@
 	initParams.pinMinSize = (MSCUChar8)pinMinSize;
 	initParams.pinCharset = pinCharset;
 	initParams.pinMixType = pinMixType;
+	initParams.setSerialNumber = setSerialNumber;
+	memcpy(initParams.serialNumber, serialNumber, MSC_SERIALNUMBER_SIZE);
+	initParams.setTokenLabel = setCardLabel;
+	memcpy(initParams.tokenLabel, cardLabel, MSC_TOKENLABEL_SIZE);
 #endif
 
 	rv = MSCWriteFramework(pConnection, &initParams);

Modified: trunk/muscleTool/muscleTool.h
===================================================================
--- trunk/muscleTool/muscleTool.h	2005-11-15 03:07:20 UTC (rev 362)
+++ trunk/muscleTool/muscleTool.h	2006-01-02 18:33:35 UTC (rev 363)
@@ -21,11 +21,14 @@
 void doRelease();
 void doMoveKey(int old_key_nb, int new_key_nb);
 void doMove(char *oldObjectID, char *newObjectID);
+void doChangeACL(char *objectID);
 void doListPINs();
 void doList();
 void doListKeys();
+void doChangeKeyACL(int key_nb);
 void doDeleteKey(int key_nb);
 void doStatus();
+void doSetStatus();
 void doDeleteID(int pin_nb);
 void doLogout();
 void doVersion();

Modified: trunk/muscleTool/parser.y
===================================================================
--- trunk/muscleTool/parser.y	2005-11-15 03:07:20 UTC (rev 362)
+++ trunk/muscleTool/parser.y	2006-01-02 18:33:35 UTC (rev 363)
@@ -54,6 +54,8 @@
 %token WRITE
 %token READ
 %token LIST
+%token CHANGEACL
+%token MOVE
 
 %token CRYPT
 %token FILECRYPT
@@ -84,7 +86,7 @@
 %token GENKEYS
 %token DELETEKEY
 %token MOVEKEY
-%token MOVE
+%token CHANGEKEYACL
 
 %token FORMAT
 %token TOKENS
@@ -92,6 +94,7 @@
 %token RESUME
 %token RELEASE
 %token STATUS
+%token SETSTATUS
 %token CHALLENGE
 %token LOGOUT
 %token _VERSION
@@ -121,6 +124,7 @@
 	|	_DELETE STRING			{ doDelete($2); }
 	|	WRITE STRING STRING		{ doWrite($2, $3); }
 	|	READ STRING STRING		{ doRead($2, $3); }
+	|	CHANGEACL STRING 			{ doChangeACL($2); }
 	|	VERIFY NUMBER 		{ doVerify($2); }
 	|	MAKEPIN NUMBER STRING STRING	{ doMakePIN($2, $3, $4); }
 	|	CHANGEPIN NUMBER { doChangePIN($2); }
@@ -130,6 +134,7 @@
 	|	LISTKEYS			{ doListKeys(); }
 	|	EXPORTKEY NUMBER STRING		{ doExportKey($2, $3); }
 	|	IMPORTKEY NUMBER STRING		{ doImportKey($2, $3); }
+	|	CHANGEKEYACL NUMBER 			{ doChangeKeyACL($2); }
 	|	GENKEYS	RSA NUMBER { doGenKeys("rsa", $3); }
 	|	GENKEYS	DSA NUMBER 	{ doGenKeys("dsa", $3); }
 	|	GENKEYS	ECFP NUMBER 	{ doGenKeys("ecfp", $3); }
@@ -161,6 +166,7 @@
 	|	RESUME OBJECTS			{ doResume("objects"); }
 	|	RELEASE				{ doRelease(); }
 	|	STATUS				{ doStatus(); }
+	|	SETSTATUS				{ doSetStatus(); }
 	|	CHALLENGE			{ doChallenge(8); }
 	|	CHALLENGE NUMBER		{ doChallenge($2); }
 	|	LOGOUT				{ doLogout(); }
@@ -177,6 +183,7 @@
 	|	HELP READ			{ help_read(); }
 	|	HELP LIST			{ help_list(); }
 	|	HELP VERIFY			{ help_verify(); }
+	|	HELP CHANGEACL		{ help_changeacl(); }
 	|	HELP MAKEPIN			{ help_makepin(); }
 	|	HELP CHANGEPIN			{ help_changepin(); }
 	|	HELP UNBLOCK			{ help_unblock(); }
@@ -184,6 +191,7 @@
 	|	HELP LISTKEYS			{ help_listkeys(); }
 	|	HELP DELETEID			{ help_deleteid(); }
 	|	HELP MOVEKEY			{ help_movekey(); }
+	|	HELP CHANGEKEYACL		{ help_changekeyacl(); }
 	|	HELP MOVE				{ help_move(); }
 	|	HELP EXPORTKEY			{ help_exportkey(); }
 	|	HELP IMPORTKEY			{ help_importkey(); }
@@ -206,6 +214,7 @@
 	|	HELP RESUME OBJECTS		{ help_resume_objects(); }
 	|	HELP RELEASE			{ help_release(); }
 	|	HELP STATUS			{ help_status(); }
+	|	HELP SETSTATUS			{ help_setstatus(); }
 	|	HELP CHALLENGE			{ help_challenge(); }
 	|	HELP LOGOUT			{ help_logout(); }
 	|	HELP _VERSION			{ help_version(); }

Modified: trunk/muscleTool/scanner.l
===================================================================
--- trunk/muscleTool/scanner.l	2005-11-15 03:07:20 UTC (rev 362)
+++ trunk/muscleTool/scanner.l	2006-01-02 18:33:35 UTC (rev 363)
@@ -50,6 +50,7 @@
 write		return WRITE;
 read		return READ;
 list		return LIST;
+changeacl	return CHANGEACL;
 
 crypt		return CRYPT;
 filecrypt	return FILECRYPT;
@@ -75,6 +76,7 @@
 deleteid	return DELETEID;
 movekey		return MOVEKEY;
 move		return MOVE;
+changekeyacl	return CHANGEKEYACL;
 
 listkeys	return LISTKEYS;
 exportkey	return EXPORTKEY;
@@ -87,6 +89,7 @@
 resume		return RESUME;
 release		return RELEASE;
 status		return STATUS;
+setstatus	return SETSTATUS;
 challenge	return CHALLENGE;
 logout		return LOGOUT;
 version		return _VERSION;

Modified: trunk/muscleTool/win32/MuscleTools.vcproj
===================================================================
--- trunk/muscleTool/win32/MuscleTools.vcproj	2005-11-15 03:07:20 UTC (rev 362)
+++ trunk/muscleTool/win32/MuscleTools.vcproj	2006-01-02 18:33:35 UTC (rev 363)
@@ -23,24 +23,25 @@
 				Name="VCCLCompilerTool"
 				Optimization="2"
 				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="..\..\libmusclecard\src\PCSC;E:\quarantine\pthread\pthreads"
-				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+				AdditionalIncludeDirectories="..\..\libmusclecard\src\PCSC\win32;..\..\libmusclecard\src\PCSC;$(pthreads)"
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;VERSION2"
 				StringPooling="TRUE"
 				RuntimeLibrary="4"
 				EnableFunctionLevelLinking="TRUE"
 				PrecompiledHeaderFile=".\Release/MuscleTools.pch"
-				AssemblerListingLocation=".\Release/"
-				ObjectFile=".\Release/"
-				ProgramDataBaseFileName=".\Release/"
+				AssemblerListingLocation="$(OutDir)/"
+				ObjectFile="$(OutDir)/"
+				ProgramDataBaseFileName="$(OutDir)/"
 				WarningLevel="3"
-				SuppressStartupBanner="TRUE"/>
+				SuppressStartupBanner="TRUE"
+				CompileAs="1"/>
 			<Tool
 				Name="VCCustomBuildTool"/>
 			<Tool
 				Name="VCLinkerTool"
 				AdditionalDependencies="pthreadVC.lib musclecard.lib"
 				OutputFile=".\Release/MuscleTools.exe"
-				LinkIncremental="1"
+				LinkIncremental="0"
 				SuppressStartupBanner="TRUE"
 				AdditionalLibraryDirectories="E:\quarantine\pthread\pthreads;..\..\libmusclecard\win32\Release"
 				ProgramDatabaseFile=".\Release/MuscleTools.pdb"
@@ -52,12 +53,17 @@
 				HeaderFileName=""/>
 			<Tool
 				Name="VCPostBuildEventTool"
-				CommandLine="mkdir ..\..\win32bin
-copy Release\muscleTools.exe ..\..\win32bin
-copy Release\muscleTools.exe &quot;C:\Program Files\Muscle\Binaries&quot;
+				Description="Installing"
+				CommandLine="set installPath=$(ProgramFiles)\Muscle\MuscleCard
+mkdir %installPath%
+copy $(OutDir)\MuscleTools.exe %installPath%
 "/>
 			<Tool
-				Name="VCPreBuildEventTool"/>
+				Name="VCPreBuildEventTool"
+				CommandLine="set path=$(GnuWin32)\bin;%path%
+&quot;$(GnuWin32)\bin\flex.exe&quot; -o../scanner.c ../scanner.l
+&quot;$(GnuWin32)\bin\bison.exe&quot; -do ../parser.c ../parser.y
+"/>
 			<Tool
 				Name="VCPreLinkEventTool"/>
 			<Tool
@@ -86,14 +92,14 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				AdditionalIncludeDirectories="..\..\libmusclecard\src\PCSC;E:\quarantine\pthread\pthreads"
-				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+				AdditionalIncludeDirectories="..\..\libmusclecard\src\PCSC\win32;..\..\libmusclecard\src\PCSC;&quot;$(pthreads)&quot;"
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;VERSION2"
 				BasicRuntimeChecks="3"
 				RuntimeLibrary="2"
 				PrecompiledHeaderFile=".\Debug/MuscleTools.pch"
-				AssemblerListingLocation=".\Debug/"
-				ObjectFile=".\Debug/"
-				ProgramDataBaseFileName=".\Debug/"
+				AssemblerListingLocation="$(OutDir)/"
+				ObjectFile="$(OutDir)/"
+				ProgramDataBaseFileName="$(OutDir)/"
 				BrowseInformation="1"
 				WarningLevel="3"
 				SuppressStartupBanner="TRUE"
@@ -105,9 +111,9 @@
 				Name="VCLinkerTool"
 				AdditionalDependencies="pthreadVC.lib musclecard.lib"
 				OutputFile=".\Debug/MuscleTools.exe"
-				LinkIncremental="1"
+				LinkIncremental="0"
 				SuppressStartupBanner="TRUE"
-				AdditionalLibraryDirectories="E:\quarantine\pthread\pthreads;..\..\libmusclecard\win32\Debug"
+				AdditionalLibraryDirectories="$(pthreads);..\..\libmusclecard\win32\Debug"
 				GenerateDebugInformation="TRUE"
 				ProgramDatabaseFile=".\Debug/MuscleTools.pdb"
 				SubSystem="1"
@@ -118,12 +124,17 @@
 				HeaderFileName=""/>
 			<Tool
 				Name="VCPostBuildEventTool"
-				CommandLine="mkdir ..\..\win32bin
-copy  Debug\muscleTools.exe ..\..\win32bin
-copy  Debug\muscleTools.exe &quot;C:\Program Files\Muscle\Binaries&quot;
+				Description="Installing"
+				CommandLine="set installPath=$(ProgramFiles)\Muscle\MuscleCard
+mkdir %installPath%
+copy $(OutDir)\MuscleTools.exe %installPath%
 "/>
 			<Tool
-				Name="VCPreBuildEventTool"/>
+				Name="VCPreBuildEventTool"
+				CommandLine="set path=$(GnuWin32)\bin;%path%
+&quot;$(GnuWin32)\bin\flex.exe&quot; -o../scanner.c ../scanner.l
+&quot;$(GnuWin32)\bin\bison.exe&quot; -do ../parser.c ../parser.y
+"/>
 			<Tool
 				Name="VCPreLinkEventTool"/>
 			<Tool




More information about the Pcsclite-cvs-commit mailing list