[Pcsclite-cvs-commit] r358 - trunk/muscleTool
Karsten Ohme
ohme-guest at costa.debian.org
Wed Oct 19 22:46:27 UTC 2005
Author: ohme-guest
Date: 2005-10-19 22:46:24 +0000 (Wed, 19 Oct 2005)
New Revision: 358
Modified:
trunk/muscleTool/.cvsignore
trunk/muscleTool/ChangeLog
trunk/muscleTool/Install.w32
trunk/muscleTool/README
trunk/muscleTool/help.c
trunk/muscleTool/help.h
trunk/muscleTool/muscleTool.c
trunk/muscleTool/muscleTool.h
trunk/muscleTool/parser.y
trunk/muscleTool/scanner.l
Log:
EC, AES and DES keys can be generated
Java Card 2.2 algorithms supported
movekey, moveobject, deleteid supported for current version of MuscleCard 2.0.0
deletepin removed
Modified: trunk/muscleTool/.cvsignore
===================================================================
--- trunk/muscleTool/.cvsignore 2005-08-07 15:52:52 UTC (rev 357)
+++ trunk/muscleTool/.cvsignore 2005-10-19 22:46:24 UTC (rev 358)
@@ -8,6 +8,4 @@
Makefile
Makefile.in
muscleTool
-parser.c
-parser.h
-scanner.c
+
Modified: trunk/muscleTool/ChangeLog
===================================================================
--- trunk/muscleTool/ChangeLog 2005-08-07 15:52:52 UTC (rev 357)
+++ trunk/muscleTool/ChangeLog 2005-10-19 22:46:24 UTC (rev 358)
@@ -1,19 +1,21 @@
History
=======
-2.0.0 - 27 May 2005, Karsten Ohme
- - genkeys can generate RSA, DSA and RSA-CRT keys
+2.0.0 - 19 Oct 2005, Karsten Ohme
+ - genkeys can generate RSA, DSA, EC, RSA-CRT, AES and DES keys
- crypt supports any combination of possible key - cipher - signature
- algorithms Java Card 2.1.1 offers and the card is capable
+ algorithms Java Card 2.1.1 and Java Card 2.2 offers and the card is capable
- 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 2.0
+ - support for version 2.0 of MuscleCard library, MuscleCard Plug-In, Card Edge 1.0.1
- enter PIN with keypad
- deletekey command
- - deletepin command
+ - deleteid command
- resume supports returns new capabilities
- extended format command
+ - movekey command
+ - moveobject command
1.0.0 - Sa Aug 14 02:51:01 CEST 2004, Toni Andjelkovic
- autoconf/automake configuration
Modified: trunk/muscleTool/Install.w32
===================================================================
--- trunk/muscleTool/Install.w32 2005-08-07 15:52:52 UTC (rev 357)
+++ trunk/muscleTool/Install.w32 2005-10-19 22:46:24 UTC (rev 358)
@@ -20,10 +20,10 @@
to get the libraries for linking and include files for compiling and nmake for the makefile.
NET Framework SDK Version 1.1
- http://www.microsoft.com/downloads/details.aspx?familyid=EBA0128F-A770-45F1-86F3-7AB010B398A3&displaylang=en
+ http://www.microsoft.com/downloads/details.aspx?FamilyID=9b3a2ca6-3647-4070-9f41-a333c6b9181d&displaylang=en
to get the file msvcrt.lib. This is a necessary runtime library, but it is not included in the two above.
- Copy this file to the lib directory of Windows® Server 2003 SP1 Platform SDK.
+ Copy this file (usually from Vc7\lib directory ) to the lib directory of the Microsoft Visual C++ Toolkit 2003.
2. You need the pthreads library for Windows
@@ -46,6 +46,12 @@
http://gnuwin32.sourceforge.net/packages/bison.htm
+ The path to the GnuWin32 tools should be in your PATH variable.
+
+ Maybe you may also consider using bison from the Cygwin environment www.cygwin.com.
+ If you experience problems with the GnuWin32 bison install Cygwin and
+ select bison to install. The path to the Cygwin should be in your PATH variable.
+
Installation:
Keep in mind, that all applications should be compiled and linked with the same debugging properties
@@ -53,6 +59,37 @@
library, then you also have to build a release version. If you want to compile pthread with debugging
information open the Visual Studio project of the pthread library and build a debug version.
+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. For Windows this is implicitly assumed, if you
+want to build a version compatible with the old components you must manually remove the /D "VERSION2" switch
+from the MuscleTools.mak file under win32.
+
+You can also use the MuscleTools.sln file for VS .NET 2003. Then you have to adjust the
+C/C++->General->Additional Include Directories, Linker->General->Additional Library Directories,
+Linker->Input->Additional Depencies and Build Events->Pre-Build Event->Command Line fields according to
+the following.
+
+Instead of editing the project settings, it may be more convenient for you
+to set globally the following environment variables. So you do not need to
+touch the project settings.
+
+GnuWin32 - The path to the GnuWin32 tools
+ --> http://gnuwin32.sourceforge.net/
+ This is the directory where all related files for the GnuWin32 packages
+ e.g. flex and bison are placed there below the bin directory.
+
+pthreads - The path to the Pthreads library
+ --> http://sourceware.org/pthreads-win32/
+ This is the directory where all related files for Pthreads-w32 are placed.
+ If you have not build pthreads by your own, you maybe have to extent the Include
+ and Library directory with "/include" and "/lib" respectively.
+
+ProgramFiles - Path for the program files. E.g. C:\Program Files. In this directory under
+ Muscle\MuscleCard\ the build executable is placed.
+
+There is also a legagy MuscleTools.dsw file for VS 6.0. You must change the above mentioned points.
+
1. Set the environment (This are include files and libraries and programms of the building environment)
for compilation and open a command prompt. If you have Microsoft Visual Studio 6.0
or .NET 2003 there is a file vcvars32.bat which does this for you
@@ -62,7 +99,7 @@
console and run the SetEnv.Cmd. Now change into the Microsoft Visual C++ Toolkit directory and run
vcvars32.bat. Now you should have a environment with the necessary tools, include and library directories.
-2. Change into libmusclecard\win32 subdirectory.
+2. Change into muscleTool\win32 subdirectory.
3. Run nmake -f MuscleTools.mak to build a release version without debugging information.
or run nmake -f MuscleTools DEBUG= to build a debug version with debugging information.
@@ -81,8 +118,14 @@
FLEX_INC - Some includes shipped with flex.
BISON - Path including file name of the bison executable
- E.g. nmake -f PCSC.mak PTHREADS_INC=C:\pthreads\Pre-build\include PTHREADS_LIB=C:\pthreads\Pre-build\lib
- PTHREADS_NAME=pthreadVC1 FLEX=C:\Program Files\GnuWin32\bin\flex.exe FLEX_INC=C:\Program Files\GnuWin32\include PCSC_INC=C:\Program Files\Muscle\Includes BISON=C:\Program Files\GnuWin32\bin\bison.exe MUSCLECARD_INC=C:\Program Files\Muscle\Includes MUSCLECARD_LIB=C:\Program Files\Muscle\Libraries
+ E.g. nmake -f PCSC.mak PTHREADS_INC=C:\pthreads\Pre-build\include
+ PTHREADS_LIB=C:\pthreads\Pre-build\lib
+ PTHREADS_NAME=pthreadVC1 FLEX=C:\Program Files\GnuWin32\bin\flex.exe
+ FLEX_INC=C:\Program Files\GnuWin32\include
+ PCSC_INC=C:\Program Files\Muscle\Includes
+ BISON=C:\Program Files\GnuWin32\bin\bison.exe
+ MUSCLECARD_INC=C:\Program Files\Muscle\MuscleCard\Includes
+ MUSCLECARD_LIB=C:\Program Files\Muscle\MuscleCard\Libraries
4. Copy the file MuscleTool.exe to a adequate directory.
Modified: trunk/muscleTool/README
===================================================================
--- trunk/muscleTool/README 2005-08-07 15:52:52 UTC (rev 357)
+++ trunk/muscleTool/README 2005-10-19 22:46:24 UTC (rev 358)
@@ -17,9 +17,9 @@
There are key, PIN, object and general related
functions.
-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
+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 can generate keys, list keys, import and export
@@ -29,14 +29,16 @@
internal format of the application on the smart card. You
will need a conversion utility for getting a standard key format.
Maybe a next release will enable with the OpenSSL library a
-usable key import and export. The crypto operations does allow also the
+usable key import and export. The crypto operations does allow also the
encryption of a given file in addition to a supplied user string.
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.
You can create, list, change, unblock and verify and PINs.
-With the new version ypu can also delete PINs.
+With the new version you can also delete IDs (PINs or keys).
+With the new version you can also renumber keys.
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-08-07 15:52:52 UTC (rev 357)
+++ trunk/muscleTool/help.c 2005-10-19 22:46:24 UTC (rev 358)
@@ -24,6 +24,9 @@
" write Write from file to object",
" read Read from object to file",
" list List objects on token",
+#ifdef VERSION2
+ " moveobject Moves an object",
+#endif
"",
"PIN related functions:",
"----------------------------------------------------",
@@ -32,7 +35,9 @@
" changepin Change a pin",
" unblock Unblock a pin",
" listpins List the pins",
- " deletepin Deletes a pin",
+#ifdef VERSION2
+ " deleteid Deletes an ID",
+#endif
"",
"Key related functions:",
"----------------------------------------------------",
@@ -40,7 +45,10 @@
" exportkey Export a key",
" importkey Import a key",
" genkeys Generate keys",
+#ifdef VERSION2
" deletekey Deletes a key",
+ " movekey Moves a key",
+#endif
" crypt Perform a cipher operation on user input",
" filecrypt Perform a cipher operation on a file",
"",
@@ -94,6 +102,15 @@
NULL,
};
+static char *help_move_txt[] = {
+ "Move an object.",
+ "Usage: move oldid newid",
+ "Arguments:",
+ " oldid object id (string)",
+ " newid object id (string)",
+ NULL,
+};
+
static char *help_write_txt[] = {
"Write from file to object.",
"Usage: write file id",
@@ -177,6 +194,15 @@
NULL
};
+static char *help_movekey_txt[] = {
+ "Move a key.",
+ "Usage: movekey oldkeynum newkeynum",
+ "Arguments:",
+ " oldkeynum old key number (num)",
+ " newkeynum new key number (num)",
+ NULL
+};
+
static char *help_importkey_txt[] = {
"Import a key.",
"Usage: importkey pin path",
@@ -190,7 +216,7 @@
"Generate keys.",
"Usage: genkeys algorithm keysize ",
"Arguments:",
- " algorithm algorithm rsa, dsa or rsacrt (string)",
+ " algorithm algorithm des, tdes, tdes3, ecfp, ecf2m, aes, rsa, dsa or rsacrt (string)",
" keysize size of key (num)",
NULL
};
@@ -243,11 +269,11 @@
NULL
};
-static char *help_deletepin_txt[] = {
- "Delete a PIN.",
- "Usage: deletepin pin",
+static char *help_deleteid_txt[] = {
+ "Delete an ID (PIN or strong identity).",
+ "Usage: deleteid ID",
"Arguments:",
- " pin pin number (num)",
+ " ID ID number (num)",
NULL
};
@@ -260,8 +286,12 @@
" rsa List RSA capabilities",
" dsa List DSA capabilities",
" des List DES capabilities",
+#ifdef VERSION2
" aes List AES capabilities",
+ " ec List Elliptic Curve capabilities",
+#endif
" 3des List 3DES capabilities",
+ " 3des3 List 3DES3 capabilities",
" keys List key capabilities",
" pins List PIN capabilities",
" objects List object capabilities",
@@ -298,12 +328,24 @@
NULL
};
+static char *help_resume_ec_txt[] = {
+ "List Elliptic Curve capabilities.",
+ "Usage: resume ec",
+ NULL
+};
+
static char *help_resume_3des_txt[] = {
"List 3DES capabilities.",
"Usage: resume 3des",
NULL
};
+static char *help_resume_3des3_txt[] = {
+ "List 3DES3 capabilities.",
+ "Usage: resume 3des3",
+ NULL
+};
+
static char *help_resume_keys_txt[] = {
"List key capabilities.",
"Usage: resume keys",
@@ -388,6 +430,16 @@
print(help_delete_txt);
}
+void help_move()
+{
+ print(help_move_txt);
+}
+
+void help_movekey()
+{
+ print(help_movekey_txt);
+}
+
void help_deletekey() {
print(help_deletekey_txt);
}
@@ -407,9 +459,9 @@
print(help_list_txt);
}
-void help_deletepin()
+void help_deleteid()
{
- print(help_deletepin_txt);
+ print(help_deleteid_txt);
}
void help_verify()
@@ -512,10 +564,19 @@
print(help_resume_3des_txt);
}
+void help_resume_3des3()
+{
+ print(help_resume_3des3_txt);
+}
+
void help_resume_aes()
{
print(help_resume_aes_txt);
}
+void help_resume_ec()
+{
+ print(help_resume_ec_txt);
+}
void help_resume_keys()
{
Modified: trunk/muscleTool/help.h
===================================================================
--- trunk/muscleTool/help.h 2005-08-07 15:52:52 UTC (rev 357)
+++ trunk/muscleTool/help.h 2005-10-19 22:46:24 UTC (rev 358)
@@ -17,13 +17,15 @@
void help_write();
void help_read();
void help_list();
+void help_move();
void help_verify();
void help_makepin();
void help_changepin();
void help_unblock();
void help_listpins();
-void help_deletepin();
+void help_deleteid();
+void help_movekey();
void help_listkeys();
void help_exportkey();
@@ -40,8 +42,11 @@
void help_resume_crypt();
void help_resume_rsa();
void help_resume_aes();
+void help_resume_ec();
void help_resume_dsa();
+void help_resume_des();
void help_resume_3des();
+void help_resume_3des3();
void help_resume_keys();
void help_resume_pins();
void help_resume_objects();
Modified: trunk/muscleTool/muscleTool.c
===================================================================
--- trunk/muscleTool/muscleTool.c 2005-08-07 15:52:52 UTC (rev 357)
+++ trunk/muscleTool/muscleTool.c 2005-10-19 22:46:24 UTC (rev 358)
@@ -5,7 +5,7 @@
Package: MuscleTools
Author : David Corcoran
Karsten Ohme
- Date : 07/31/05
+ Date : 09/24/05
License: Copyright (C) 2002 David Corcoran
<corcoran at linuxnet.com>
Purpose: A shell for the MuscleCard framework
@@ -151,16 +151,36 @@
{
MSCULong32 i;
MSCULong32 count = 0;
- MSCUChar8 c;
- MSCUChar8 shortData[3];
+ unsigned long c;
+ char shortData[3];
+ MSCULong32 start = 0;
+ int ret;
- for (i = 0; i < strlen((char *)data); i += 2)
+ MSCULong32 len = strlen((char *)data);
+ /* First character must be padded with additional 0 */
+ if ((len % 2) != 0) {
+ start = 1;
+ shortData[0] = 0;
+ shortData[1] = data[0];
+ shortData[2] = '\0';
+ ret = sscanf(shortData, "%x", &c);
+ if (ret <= 0) {
+ c = 0;
+ }
+ out[count] = (MSCUChar8)c;
+ count++;
+ }
+
+ for (i = start; i < len; i += 2)
{
shortData[0] = data[i];
shortData[1] = data[i + 1];
- shortData[2] = 0x00;
- sscanf((char *)shortData, "%hX", &c);
- out[count] = c;
+ shortData[2] = '\0';
+ ret = sscanf(shortData, "%x", &c);
+ if (ret <= 0) {
+ c = 0;
+ }
+ out[count] = (MSCUChar8)c;
count++;
}
@@ -242,29 +262,65 @@
}
#else
void doDeleteKey(int key_nb) {
- printf("Not supported in MuscleTool 1.0 \n");
+ printf("Not supported. \n");
return;
}
#endif
#ifdef VERSION2
-void doDeletePIN(int pin_nb) {
+void doDeleteID(int pin_nb) {
MSCLong32 rv = 0;
CHECK_ERR(pConnection == 0, "Must Connect First !");
- rv = MSCDeletePIN(pConnection, (MSCUChar8)pin_nb);
- CHECK_ERR(rv != MSC_SUCCESS, "DeletePIN Failed !");
- printf("DeletePIN Successful\n");
+ rv = MSCDeleteID(pConnection, (MSCUChar8)pin_nb);
+ CHECK_ERR(rv != MSC_SUCCESS, "DeleteID Failed !");
+ printf("DeleteID Successful\n");
end:
return;
}
#else
-void doDeletePIN(int pin_nb) {
- printf("Not supported in MuscleTool 1.0 \n");
+void doDeleteID(int pin_nb) {
+ printf("Not supported. \n");
}
#endif
+#ifdef VERSION2
+void doMove(char *oldObjectID, char *newObjectID) {
+ MSCLong32 rv = 0;
+
+ CHECK_ERR(pConnection == 0, "Must Connect First !");
+
+ rv = MSCMoveObject(pConnection, (MSCString)oldObjectID, (MSCString)newObjectID);
+ CHECK_ERR(rv != MSC_SUCCESS, "MoveObject Failed !");
+ printf("MoveObject Successful\n");
+end:
+ return;
+}
+#else
+void doMove(char *oldObjectID, char *newObjectID) {
+ printf("Not supported. \n");
+}
+#endif
+
+#ifdef VERSION2
+void doMoveKey(int old_key_nb, int new_key_nb) {
+ MSCLong32 rv = 0;
+
+ CHECK_ERR(pConnection == 0, "Must Connect First !");
+
+ rv = MSCMoveKey(pConnection, (MSCUChar8)old_key_nb, (MSCUChar8)new_key_nb);
+ CHECK_ERR(rv != MSC_SUCCESS, "MoveKey Failed !");
+ printf("MoveKey Successful\n");
+end:
+ return;
+}
+#else
+void doMoveKey(int old_key_nb, int new_key_nb) {
+ printf("Not supported. \n");
+}
+#endif
+
void doListTokens()
{
MSCLong32 rv;
@@ -273,7 +329,7 @@
if (tokenList)
{
free(tokenList);
- tokenList = 0;
+ tokenList = NULL;
tokenSize = 0;
}
@@ -326,7 +382,7 @@
}
rv = MSCEstablishConnection(&tokenList[tokenNumber - 1],
- MSC_SHARE_SHARED, 0, 0, pConnection);
+ MSC_SHARE_SHARED, NULL, 0, pConnection);
if (rv != MSC_SUCCESS)
{
free(pConnection);
@@ -453,7 +509,7 @@
case MSC_KEY_DSA_PUBLIC:
case MSC_KEY_DSA_PRIVATE:
if ((ciphDir & MSC_KEYPOLICY_DIR_SIGN) || (ciphDir & MSC_KEYPOLICY_DIR_VERIFY)) {
- if (cipherSignatureMode & MSC_KEYPOLICY_MODE_DSA_SHA)
+ if (cipherSignatureMode & MSC_KEYPOLICY_MODE_SIGNATURE_DSA_SHA)
printf("%16s\n", "SHA");
}
break;
@@ -641,13 +697,15 @@
rv = MSCGetStatus(pConnection, &pStatusStruct);
CHECK_ERR(rv != MSC_SUCCESS, "GetStatus Failed !");
- printf(" Version: %04X %04X\n", pStatusStruct.appVersion,
- pStatusStruct.swVersion);
- 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: ");
+ 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");
end:
@@ -667,9 +725,6 @@
ulValue = 0;
#ifdef VERSION2
- rv = MSCGetCapabilities(pConnection, MSC_TAG_SUPPORT_FUNCTIONS,
- (MSCPUChar8)capability, &retLength);
- CHECK_ERR(rv != MSC_SUCCESS, "Getting attribute TAG_SUPPORT_FUNCTIONS");
if (type != NULL)
{
@@ -692,6 +747,8 @@
PRINT_SUPPORT(usValue & MSC_SUPPORT_3DES);
printf("AES ");
PRINT_SUPPORT(usValue & MSC_SUPPORT_AES);
+ printf("EC ");
+ PRINT_SUPPORT(usValue & MSC_SUPPORT_ECURVE);
return;
}
else if (strcmp(type, "rsa") == 0)
@@ -699,105 +756,122 @@
rv = MSCGetCapabilities(pConnection, MSC_TAG_CAPABLE_RSA,
(MSCPUChar8) capability, &retLength);
CHECK_ERR(rv != MSC_SUCCESS, "Getting attribute TAG_CAPABLE_RSA");
+ usValue = capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_KEY_LENGTHS];
+ printf("%04lX\n",usValue);
printf("\n");
printf("RSA Capabilities Supported\n");
printf("---------------------------------------------------------------\n");
printf("\n");
printf("Possible Key Lengths:\n\n");
{
- printf("512 Bit ");
- PRINT_SUPPORT(capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_KEY_LENGTHS] &
- MSC_CAPABLE_RSA_512);
- printf("768 Bit ");
- PRINT_SUPPORT(capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_KEY_LENGTHS] &
- MSC_CAPABLE_RSA_768);
- printf("1024 Bit ");
- PRINT_SUPPORT(capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_KEY_LENGTHS] &
- MSC_CAPABLE_RSA_1024);
- printf("2048 Bit ");
- PRINT_SUPPORT(capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_KEY_LENGTHS] &
- MSC_CAPABLE_RSA_2048);
- printf("512 Bit CRT ");
- PRINT_SUPPORT(capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_KEY_LENGTHS] &
- MSC_CAPABLE_RSA_CRT_512);
- printf("768 Bit CRT ");
- PRINT_SUPPORT(capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_KEY_LENGTHS] &
- MSC_CAPABLE_RSA_CRT_768);
- printf("1024 Bit CRT ");
- PRINT_SUPPORT(capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_KEY_LENGTHS] &
- MSC_CAPABLE_RSA_CRT_1024);
- printf("2048 Bit CRT ");
- PRINT_SUPPORT(capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_KEY_LENGTHS] &
- MSC_CAPABLE_RSA_CRT_2048);
+ printf("512 Bit ");
+ PRINT_SUPPORT(usValue &
+ MSC_CAPABLE_RSA_512);
+ printf("768 Bit ");
+ PRINT_SUPPORT(usValue &
+ MSC_CAPABLE_RSA_768);
+ printf("1024 Bit ");
+ PRINT_SUPPORT(usValue &
+ MSC_CAPABLE_RSA_1024);
+ printf("2048 Bit ");
+ PRINT_SUPPORT(usValue &
+ MSC_CAPABLE_RSA_2048);
+ printf("512 Bit CRT ");
+ PRINT_SUPPORT(usValue &
+ MSC_CAPABLE_RSA_CRT_512);
+ printf("768 Bit CRT ");
+ PRINT_SUPPORT(usValue &
+ MSC_CAPABLE_RSA_CRT_768);
+ printf("1024 Bit CRT ");
+ PRINT_SUPPORT(usValue &
+ MSC_CAPABLE_RSA_CRT_1024);
+ printf("2048 Bit CRT ");
+ PRINT_SUPPORT(usValue &
+ MSC_CAPABLE_RSA_CRT_2048);
}
+ usValue = capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_KEY_GENS];
printf("\n");
printf("Possible Key Generations:\n\n");
{
- printf("512 Bit ");
- PRINT_SUPPORT(capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_KEY_GENS] &
- MSC_CAPABLE_KEYGEN_RSA_512);
- printf("768 Bit ");
- PRINT_SUPPORT(capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_KEY_GENS] &
- MSC_CAPABLE_KEYGEN_RSA_768);
- printf("1024 Bit ");
- PRINT_SUPPORT(capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_KEY_GENS] &
- MSC_CAPABLE_KEYGEN_RSA_1024);
- printf("2048 Bit ");
- PRINT_SUPPORT(capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_KEY_GENS] &
- MSC_CAPABLE_KEYGEN_RSA_2048);
- printf("512 Bit CRT ");
- PRINT_SUPPORT(capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_KEY_GENS] &
- MSC_CAPABLE_KEYGEN_RSA_CRT_512);
- printf("768 Bit CRT ");
- PRINT_SUPPORT(capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_KEY_GENS] &
- MSC_CAPABLE_KEYGEN_RSA_CRT_768);
- printf("1024 Bit CRT ");
- PRINT_SUPPORT(capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_KEY_GENS] &
- MSC_CAPABLE_KEYGEN_RSA_CRT_1024);
- printf("2048 Bit CRT ");
- PRINT_SUPPORT(capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_KEY_GENS] &
- MSC_CAPABLE_KEYGEN_RSA_CRT_2048);
+ printf("512 Bit ");
+ PRINT_SUPPORT(usValue &
+ MSC_CAPABLE_KEYGEN_RSA_512);
+ printf("768 Bit ");
+ PRINT_SUPPORT(usValue &
+ MSC_CAPABLE_KEYGEN_RSA_768);
+ printf("1024 Bit ");
+ PRINT_SUPPORT(usValue &
+ MSC_CAPABLE_KEYGEN_RSA_1024);
+ printf("2048 Bit ");
+ PRINT_SUPPORT(usValue &
+ MSC_CAPABLE_KEYGEN_RSA_2048);
+ printf("512 Bit CRT ");
+ PRINT_SUPPORT(usValue &
+ MSC_CAPABLE_KEYGEN_RSA_CRT_512);
+ printf("768 Bit CRT ");
+ PRINT_SUPPORT(usValue &
+ MSC_CAPABLE_KEYGEN_RSA_CRT_768);
+ printf("1024 Bit CRT ");
+ PRINT_SUPPORT(usValue &
+ MSC_CAPABLE_KEYGEN_RSA_CRT_1024);
+ printf("2048 Bit CRT ");
+ PRINT_SUPPORT(usValue &
+ MSC_CAPABLE_KEYGEN_RSA_CRT_2048);
}
+ usValue = capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_SIGNATURE_ALGS];
printf("\n");
printf("Possible Signature Algorithms:\n\n");
{
- printf("Signature with MD5 Hash and PKCS#1 Padding ");
- PRINT_SUPPORT(capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_SIGNATURE_ALGS] &
- MSC_CAPABLE_SIGNATURE_RSA_MD5_PKCS1);
- printf("Signature with MD5 Hash and RFC 2409 Padding ");
- PRINT_SUPPORT(capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_SIGNATURE_ALGS] &
- MSC_CAPABLE_SIGNATURE_RSA_MD5_RFC2409);
- printf("Signature with RIPE MD-160 Hash and ISO 9796 Padding ");
- PRINT_SUPPORT(capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_SIGNATURE_ALGS] &
- MSC_CAPABLE_SIGNATURE_RSA_RIPEMD160_ISO9796);
- printf("Signature with RIPE MD-160 Hash and PKCS#1 Padding ");
- PRINT_SUPPORT(capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_SIGNATURE_ALGS] &
- MSC_CAPABLE_SIGNATURE_RSA_RIPEMD160_PKCS1);
- printf("Signature with SHA-1 Hash and ISO 9796 Padding ");
- PRINT_SUPPORT(capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_SIGNATURE_ALGS] &
- MSC_CAPABLE_SIGNATURE_RSA_SHA_ISO9796);
- printf("Signature with SHA-1 Hash and PKCS#1 Padding ");
- PRINT_SUPPORT(capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_SIGNATURE_ALGS] &
- MSC_CAPABLE_SIGNATURE_RSA_SHA_PKCS1);
- printf("Signature with SHA-1 Hash and RFC 2409 Padding ");
- PRINT_SUPPORT(capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_SIGNATURE_ALGS] &
- MSC_CAPABLE_SIGNATURE_RSA_SHA_RFC2409);
+ printf("Signature with MD5 Hash and PKCS#1 Padding ");
+ PRINT_SUPPORT(usValue &
+ MSC_CAPABLE_SIGNATURE_RSA_MD5_PKCS1);
+ printf("Signature with MD5 Hash and RFC 2409 Padding ");
+ PRINT_SUPPORT(usValue &
+ MSC_CAPABLE_SIGNATURE_RSA_MD5_RFC2409);
+ printf("Signature with RIPE MD-160 Hash and ISO 9796 Padding ");
+ PRINT_SUPPORT(usValue &
+ MSC_CAPABLE_SIGNATURE_RSA_RIPEMD160_ISO9796);
+ printf("Signature with RIPE MD-160 Hash and PKCS#1 Padding ");
+ PRINT_SUPPORT(usValue &
+ MSC_CAPABLE_SIGNATURE_RSA_RIPEMD160_PKCS1);
+ printf("Signature with SHA-1 Hash and ISO 9796 Padding ");
+ PRINT_SUPPORT(usValue &
+ MSC_CAPABLE_SIGNATURE_RSA_SHA_ISO9796);
+ printf("Signature with SHA-1 Hash and PKCS#1 Padding ");
+ PRINT_SUPPORT(usValue &
+ MSC_CAPABLE_SIGNATURE_RSA_SHA_PKCS1);
+ printf("Signature with SHA-1 Hash and RFC 2409 Padding ");
+ PRINT_SUPPORT(usValue &
+ MSC_CAPABLE_SIGNATURE_RSA_SHA_RFC2409);
+ printf("Signature with SHA-1 Hash and PKCS#1-PSS Padding ");
+ PRINT_SUPPORT(usValue &
+ MSC_CAPABLE_SIGNATURE_RSA_SHA_PKCS1_PSS);
+ printf("Signature with MD5 Hash and PKCS#1-PSS Padding ");
+ PRINT_SUPPORT(usValue &
+ MSC_CAPABLE_SIGNATURE_RSA_MD5_PKCS1_PSS);
+ printf("Signature with RIPE MD-160 Hash and PKCS#1-PSS Padding ");
+ PRINT_SUPPORT(usValue &
+ MSC_CAPABLE_SIGNATURE_RSA_RIPEMD160_PKCS1_PSS);
}
+ usValue = capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_CIPHER_ALGS];
printf("\n");
printf("Possible Cipher Algorithms:\n\n");
{
- printf("Cipher with ISO 14888 Padding ");
- PRINT_SUPPORT(capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_CIPHER_ALGS] &
- MSC_CAPABLE_CIPHER_RSA_ISO_14888)
- printf("Cipher with ISO 9796 Padding ");
- PRINT_SUPPORT(capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_CIPHER_ALGS] &
- MSC_CAPABLE_CIPHER_RSA_ISO_9796);
- printf("Cipher with No Padding ");
- PRINT_SUPPORT(capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_CIPHER_ALGS] &
- MSC_CAPABLE_CIPHER_RSA_NOPAD);
- printf("Cipher with PKCS#1 Padding ");
- PRINT_SUPPORT(capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_CIPHER_ALGS] &
- MSC_CAPABLE_CIPHER_RSA_PKCS1);
+ printf("Cipher with ISO 14888 Padding ");
+ PRINT_SUPPORT(usValue &
+ MSC_CAPABLE_CIPHER_RSA_ISO_14888)
+ printf("Cipher with ISO 9796 Padding ");
+ PRINT_SUPPORT(usValue &
+ MSC_CAPABLE_CIPHER_RSA_ISO_9796);
+ printf("Cipher with No Padding ");
+ PRINT_SUPPORT(usValue &
+ MSC_CAPABLE_CIPHER_RSA_NOPAD);
+ printf("Cipher with PKCS#1 Padding ");
+ PRINT_SUPPORT(usValue &
+ MSC_CAPABLE_CIPHER_RSA_PKCS1);
+ printf("Cipher with PKCS#1-OAEP Padding ");
+ PRINT_SUPPORT(usValue &
+ MSC_CAPABLE_CIPHER_RSA_PKCS1_OAEP);
}
return;
}
@@ -806,49 +880,135 @@
rv = MSCGetCapabilities(pConnection, MSC_TAG_CAPABLE_DSA,
(MSCPUChar8) capability, &retLength);
CHECK_ERR(rv != MSC_SUCCESS, "Getting attribute TAG_CAPABLE_DSA");
+ usValue = capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_KEY_LENGTHS];
printf("\n");
printf("DSA Capabilities Supported\n");
printf("---------------------------------------------------------------\n");
printf("\n");
printf("Possible Key Lengths:\n\n");
{
- printf("512 Bit ");
- PRINT_SUPPORT(capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_KEY_LENGTHS] &
- MSC_CAPABLE_DSA_512);
- printf("768 Bit ");
- PRINT_SUPPORT(capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_KEY_LENGTHS] &
- MSC_CAPABLE_DSA_768);
- printf("1024 Bit ");
- PRINT_SUPPORT(capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_KEY_LENGTHS] &
- MSC_CAPABLE_DSA_1024);
+ printf("512 Bit ");
+ PRINT_SUPPORT(usValue &
+ MSC_CAPABLE_DSA_512);
+ printf("768 Bit ");
+ PRINT_SUPPORT(usValue &
+ MSC_CAPABLE_DSA_768);
+ printf("1024 Bit ");
+ PRINT_SUPPORT(usValue &
+ MSC_CAPABLE_DSA_1024);
}
+ usValue = capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_KEY_GENS];
printf("\n");
printf("Possible Key Generations:\n\n");
{
- printf("512 Bit ");
- PRINT_SUPPORT(capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_KEY_GENS] &
- MSC_CAPABLE_KEYGEN_DSA_512);
- printf("768 Bit ");
- PRINT_SUPPORT(capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_KEY_GENS] &
- MSC_CAPABLE_KEYGEN_DSA_768);
- printf("1024 Bit ");
- PRINT_SUPPORT(capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_KEY_GENS] &
- MSC_CAPABLE_KEYGEN_DSA_1024);
+ printf("512 Bit ");
+ PRINT_SUPPORT(usValue &
+ MSC_CAPABLE_KEYGEN_DSA_512);
+ printf("768 Bit ");
+ PRINT_SUPPORT(usValue &
+ MSC_CAPABLE_KEYGEN_DSA_768);
+ printf("1024 Bit ");
+ PRINT_SUPPORT(usValue &
+ MSC_CAPABLE_KEYGEN_DSA_1024);
}
+ usValue = capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_SIGNATURE_ALGS];
printf("\n");
printf("Possible Signature Algorithms:\n\n");
{
- printf("Signature with SHA-1 Hash ");
- PRINT_SUPPORT(capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_SIGNATURE_ALGS] &
- MSC_CAPABLE_SIGNATURE_DSA_SHA);
+ printf("Signature with SHA-1 Hash ");
+ PRINT_SUPPORT(usValue &
+ MSC_CAPABLE_SIGNATURE_DSA_SHA);
+ printf("Signature with Elliptic Curves Key and SHA-1 Hash ");
+ PRINT_SUPPORT(usValue &
+ MSC_CAPABLE_SIGNATURE_ECDSA_SHA);
}
return;
}
+ else if (strcmp(type, "ec") == 0)
+ {
+ rv = MSCGetCapabilities(pConnection, MSC_TAG_CAPABLE_ECURVE,
+ (MSCPUChar8) capability, &retLength);
+ CHECK_ERR(rv != MSC_SUCCESS, "Getting attribute TAG_CAPABLE_ECURVE");
+ usValue = capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_KEY_LENGTHS];
+ printf("\n");
+ printf("EC Capabilities Supported\n");
+ printf("---------------------------------------------------------------\n");
+ printf("\n");
+ printf("Possible Key Lengths:\n\n");
+ {
+ printf("112 Bit FP ");
+ PRINT_SUPPORT(usValue &
+ MSC_CAPABLE_EC_FP_112);
+ printf("113 Bit F2M ");
+ PRINT_SUPPORT(usValue &
+ MSC_CAPABLE_EC_F2M_113);
+ printf("128 Bit FP ");
+ PRINT_SUPPORT(usValue &
+ MSC_CAPABLE_EC_FP_128);
+ printf("131 Bit F2M ");
+ PRINT_SUPPORT(usValue &
+ MSC_CAPABLE_EC_F2M_131);
+ printf("160 Bit FP ");
+ PRINT_SUPPORT(usValue &
+ MSC_CAPABLE_EC_FP_160);
+ printf("163 Bit F2M ");
+ PRINT_SUPPORT(usValue &
+ MSC_CAPABLE_EC_F2M_163);
+ printf("192 Bit FP ");
+ PRINT_SUPPORT(usValue &
+ MSC_CAPABLE_EC_FP_192);
+ printf("193 Bit F2M ");
+ PRINT_SUPPORT(usValue &
+ MSC_CAPABLE_EC_F2M_193);
+ }
+ usValue = capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_KEY_GENS];
+ printf("\n");
+ printf("Possible Key Generations:\n\n");
+ {
+ printf("112 Bit FP ");
+ PRINT_SUPPORT(usValue &
+ MSC_CAPABLE_KEYGEN_EC_FP_112);
+ printf("113 Bit F2M ");
+ PRINT_SUPPORT(usValue &
+ MSC_CAPABLE_KEYGEN_EC_F2M_113);
+ printf("128 Bit FP ");
+ PRINT_SUPPORT(usValue &
+ MSC_CAPABLE_KEYGEN_EC_FP_128);
+ printf("131 Bit F2M ");
+ PRINT_SUPPORT(usValue &
+ MSC_CAPABLE_KEYGEN_EC_F2M_131);
+ printf("160 Bit FP ");
+ PRINT_SUPPORT(usValue &
+ MSC_CAPABLE_KEYGEN_EC_FP_160);
+ printf("163 Bit F2M ");
+ PRINT_SUPPORT(usValue &
+ MSC_CAPABLE_KEYGEN_EC_F2M_163);
+ printf("192 Bit FP ");
+ PRINT_SUPPORT(usValue &
+ MSC_CAPABLE_KEYGEN_EC_FP_192);
+ printf("193 Bit F2M ");
+ PRINT_SUPPORT(usValue &
+ MSC_CAPABLE_KEYGEN_EC_F2M_193);
+ }
+ usValue = capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_SIGNATURE_ALGS];
+ printf("\n");
+ printf("Possible Signature Algorithms:\n\n");
+ {
+ printf("Signature with SHA-1 Hash ");
+ PRINT_SUPPORT(usValue &
+ MSC_CAPABLE_SIGNATURE_DSA_SHA);
+ printf("Signature with Elliptic Curves Key and SHA-1 Hash ");
+ PRINT_SUPPORT(usValue &
+ MSC_CAPABLE_SIGNATURE_ECDSA_SHA);
+ }
+ return;
+ }
else if (strcmp(type, "aes") == 0)
{
rv = MSCGetCapabilities(pConnection, MSC_TAG_CAPABLE_AES,
(MSCPUChar8) capability, &retLength);
CHECK_ERR(rv != MSC_SUCCESS, "Getting attribute TAG_CAPABLE_AES");
+ usValue = capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_KEY_LENGTHS];
printf("\n");
printf("AES Capabilities Supported\n");
printf("---------------------------------------------------------------\n");
@@ -856,30 +1016,32 @@
printf("Possible Key Lengths:\n\n");
{
printf("128 Bit ");
- PRINT_SUPPORT(capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_KEY_LENGTHS] &
+ PRINT_SUPPORT(usValue &
MSC_CAPABLE_AES_128);
printf("192 Bit ");
- PRINT_SUPPORT(capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_KEY_LENGTHS] &
+ PRINT_SUPPORT(usValue &
MSC_CAPABLE_AES_192);
- printf("256 Bit ");
- PRINT_SUPPORT(capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_KEY_LENGTHS] &
+ printf("256 Bit ");
+ PRINT_SUPPORT(usValue &
MSC_CAPABLE_AES_256);
}
+ usValue = capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_SIGNATURE_ALGS];
printf("\n");
printf("Possible Signature Algorithms:\n\n");
{
printf("Signature AES with blocksize 128 in CBC mode ");
- PRINT_SUPPORT(capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_SIGNATURE_ALGS] &
+ PRINT_SUPPORT(usValue &
MSC_CAPABLE_SIGNATURE_AES_MAC_128_NOPAD);
}
+ usValue = capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_CIPHER_ALGS];
printf("\n");
printf("Possible Cipher Algorithms:\n\n");
{
printf("Cipher with block size 128 in CBC mode with no padding ");
- PRINT_SUPPORT(capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_CIPHER_ALGS] &
+ PRINT_SUPPORT(usValue &
MSC_CAPABLE_CIPHER_AES_BLOCK_128_CBC_NOPAD);
printf("Cipher with block size 128 in ECB mode with no padding ");
- PRINT_SUPPORT(capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_CIPHER_ALGS] &
+ PRINT_SUPPORT(usValue &
MSC_CAPABLE_CIPHER_AES_BLOCK_128_ECB_NOPAD);
}
return;
@@ -889,6 +1051,7 @@
rv = MSCGetCapabilities(pConnection, MSC_TAG_CAPABLE_DES,
(MSCPUChar8) capability, &retLength);
CHECK_ERR(rv != MSC_SUCCESS, "Getting attribute TAG_CAPABLE_RSA");
+ usValue = capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_KEY_LENGTHS];
printf("\n");
printf("DES Capabilities Supported\n");
printf("---------------------------------------------------------------\n");
@@ -896,69 +1059,77 @@
printf("Possible Key Lengths:\n\n");
{
printf("64 Bit ");
- PRINT_SUPPORT(capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_KEY_LENGTHS] &
+ PRINT_SUPPORT(usValue &
MSC_CAPABLE_DES);
printf("128 Bit ");
- PRINT_SUPPORT(capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_KEY_LENGTHS] &
+ PRINT_SUPPORT(usValue &
MSC_CAPABLE_3DES_2KEY);
printf("192 Bit ");
- PRINT_SUPPORT(capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_KEY_LENGTHS] &
+ PRINT_SUPPORT(usValue &
MSC_CAPABLE_3DES_3KEY);
}
+ usValue = capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_SIGNATURE_ALGS];
printf("\n");
printf("Possible Signature Algorithms:\n\n");
{
printf("Signature 4 Byte MAC with ISO 9797 Method 1 Padding ");
- PRINT_SUPPORT(capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_SIGNATURE_ALGS] &
+ PRINT_SUPPORT(usValue &
MSC_CAPABLE_SIGNATURE_DES_MAC4_ISO9797_M1);
printf("Signature 4 Byte MAC with ISO 9797 Method 2 Padding ");
- PRINT_SUPPORT(capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_SIGNATURE_ALGS] &
+ PRINT_SUPPORT(usValue &
MSC_CAPABLE_SIGNATURE_DES_MAC4_ISO9797_M2);
printf("Signature 4 Byte MAC with No Padding ");
- PRINT_SUPPORT(capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_SIGNATURE_ALGS] &
+ PRINT_SUPPORT(usValue &
MSC_CAPABLE_SIGNATURE_DES_MAC4_NOPAD);
printf("Signature 4 Byte MAC with PKCS#5 Padding ");
- PRINT_SUPPORT(capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_SIGNATURE_ALGS] &
+ PRINT_SUPPORT(usValue &
MSC_CAPABLE_SIGNATURE_DES_MAC4_PKCS5);
printf("Signature 8 Byte MAC with ISO 9797 Method 1 Padding ");
- PRINT_SUPPORT(capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_SIGNATURE_ALGS] &
+ PRINT_SUPPORT(usValue &
MSC_CAPABLE_SIGNATURE_DES_MAC8_ISO9797_M1);
printf("Signature 8 Byte MAC with ISO 9797 Method 2 Padding ");
- PRINT_SUPPORT(capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_SIGNATURE_ALGS] &
+ PRINT_SUPPORT(usValue &
MSC_CAPABLE_SIGNATURE_DES_MAC8_ISO9797_M2);
printf("Signature 8 Byte MAC with No Padding ");
- PRINT_SUPPORT(capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_SIGNATURE_ALGS] &
+ PRINT_SUPPORT(usValue &
MSC_CAPABLE_SIGNATURE_DES_MAC8_NOPAD);
printf("Signature 8 Byte MAC with PKCS#5 Padding ");
- PRINT_SUPPORT(capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_SIGNATURE_ALGS] &
+ PRINT_SUPPORT(usValue &
MSC_CAPABLE_SIGNATURE_DES_MAC8_PKCS5);
+ printf("Signature 4 Byte MAC with ISO 9797-1 Alg. 3 Meth. 2 ");
+ PRINT_SUPPORT(usValue &
+ MSC_CAPABLE_SIGNATURE_DES_MAC4_ISO9797_1_M2_ALG3);
+ printf("Signature 8 Byte MAC with ISO 9797-1 Alg. 3 Meth. 2 ");
+ PRINT_SUPPORT(usValue &
+ MSC_CAPABLE_SIGNATURE_DES_MAC8_ISO9797_1_M2_ALG3);
}
+ usValue = capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_CIPHER_ALGS];
printf("\n");
printf("Possible Cipher Algorithms:\n\n");
{
printf("Cipher with CBC and ISO 9797 Method 1 Padding ");
- PRINT_SUPPORT(capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_CIPHER_ALGS] &
+ PRINT_SUPPORT(usValue &
MSC_CAPABLE_CIPHER_DES_CBC_ISO9797_M1)
printf("Cipher with CBC and ISO 9797 Method 2 Padding ");
- PRINT_SUPPORT(capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_CIPHER_ALGS] &
+ PRINT_SUPPORT(usValue &
MSC_CAPABLE_CIPHER_DES_CBC_ISO9797_M2)
printf("Cipher with CBC and No Padding ");
- PRINT_SUPPORT(capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_CIPHER_ALGS] &
+ PRINT_SUPPORT(usValue &
MSC_CAPABLE_CIPHER_DES_CBC_NOPAD)
printf("Cipher with CBC and PKCS#5 Padding ");
- PRINT_SUPPORT(capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_CIPHER_ALGS] &
+ PRINT_SUPPORT(usValue &
MSC_CAPABLE_CIPHER_DES_CBC_PKCS5)
printf("Cipher with ECB and ISO 9797 Method 1 Padding ");
- PRINT_SUPPORT(capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_CIPHER_ALGS] &
+ PRINT_SUPPORT(usValue &
MSC_CAPABLE_CIPHER_DES_ECB_ISO9797_M1)
printf("Cipher with ECB and ISO 9797 Method 2 Padding ");
- PRINT_SUPPORT(capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_CIPHER_ALGS] &
+ PRINT_SUPPORT(usValue &
MSC_CAPABLE_CIPHER_DES_ECB_ISO9797_M2)
printf("Cipher with ECB and No Padding ");
- PRINT_SUPPORT(capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_CIPHER_ALGS] &
+ PRINT_SUPPORT(usValue &
MSC_CAPABLE_CIPHER_DES_ECB_NOPAD)
printf("Cipher with ECB and PKCS#5 Padding ");
- PRINT_SUPPORT(capability[MSC_ALGORITHM_CAPABILITIES_OFFSET_POSSIBLE_CIPHER_ALGS] &
+ PRINT_SUPPORT(usValue &
MSC_CAPABLE_CIPHER_DES_ECB_PKCS5)
}
return;
@@ -1093,6 +1264,8 @@
PRINT_SUPPORT(ulValue & MSC_SUPPORT_DSA);
printf("ELGAMAL ");
PRINT_SUPPORT(ulValue & MSC_SUPPORT_ELGAMAL);
+ printf("Elliptic Curves ");
+ PRINT_SUPPORT(ulValue & MSC_SUPPORT_ECURVE);
printf("DES ");
PRINT_SUPPORT(ulValue & MSC_SUPPORT_DES);
printf("3DES ");
@@ -1313,6 +1486,10 @@
#endif
else {
#ifdef VERSION2
+ rv = MSCGetCapabilities(pConnection, MSC_TAG_SUPPORT_FUNCTIONS,
+ (MSCPUChar8)capability, &retLength);
+ CHECK_ERR(rv != MSC_SUCCESS, "Getting attribute TAG_SUPPORT_FUNCTIONS");
+
printf("\n");
printf("Functions Supported\n");
printf("-------------------------------\n");
@@ -1320,6 +1497,8 @@
PRINT_SUPPORT(capability[MSC_SUPPORTED_FUNCTIONS_OFFSET_KEY_USE_AND_MANAGEMENT] & MSC_SUPPORT_GENKEYS);
printf("MSCImportKey ");
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("MSCExportKey ");
PRINT_SUPPORT(capability[MSC_SUPPORTED_FUNCTIONS_OFFSET_KEY_USE_AND_MANAGEMENT] & MSC_SUPPORT_EXPORTKEY);
printf("MSCComputeCrypt ");
@@ -1339,8 +1518,8 @@
PRINT_SUPPORT(capability[MSC_SUPPORTED_FUNCTIONS_OFFSET_EXT_AUTH] & MSC_SUPPORT_CHANGEPIN);
printf("MSCUnblockPIN ");
PRINT_SUPPORT(capability[MSC_SUPPORTED_FUNCTIONS_OFFSET_EXT_AUTH] & MSC_SUPPORT_UNBLOCKPIN);
- printf("MSCDeletePIN ");
- PRINT_SUPPORT(capability[MSC_SUPPORTED_FUNCTIONS_OFFSET_EXT_AUTH] & MSC_SUPPORT_DELETEPIN)
+ printf("MSCDeleteID ");
+ PRINT_SUPPORT(capability[MSC_SUPPORTED_FUNCTIONS_OFFSET_EXT_AUTH] & MSC_SUPPORT_DELETEID)
printf("MSCLogoutAll ");
PRINT_SUPPORT(capability[MSC_SUPPORTED_FUNCTIONS_OFFSET_EXT_AUTH] & MSC_SUPPORT_LOGOUTALL);
printf("MSCGetChallenge ");
@@ -1350,6 +1529,8 @@
printf("MSCListObjects ");
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("MSCCreateObject ");
PRINT_SUPPORT(capability[MSC_SUPPORTED_FUNCTIONS_OFFSET_OBJECT_USE_AND_MANGEMENT] & MSC_SUPPORT_CREATEOBJECT);
printf("MSCDeleteObject ");
@@ -1363,6 +1544,10 @@
printf("MSCGetStatus ");
PRINT_SUPPORT(capability[MSC_SUPPORTED_FUNCTIONS_OFFSET_STATUS] & MSC_SUPPORT_GETSTATUS);
#else
+ rv = MSCGetCapabilities(pConnection, MSC_TAG_SUPPORT_FUNCTIONS,
+ (MSCPUChar8)(&ulValue), &retLength);
+ CHECK_ERR(rv != MSC_SUCCESS, "Getting attribute TAG_SUPPORT_FUNCTIONS");
+
printf("Functions Supported\n");
printf("-------------------------------\n");
printf("MSCGenerateKeys ");
@@ -1490,11 +1675,11 @@
NULL, 0);
}
else {
- rv = getStringValue("Enter PIN", "Enter PIN", pinData, 17);
+ rv = getStringValue("Enter PIN", "Enter PIN", (char *)pinData, 17);
if (rv == 0)
goto abort;
- pinSize = strlen(pinData);
+ pinSize = strlen((char *)pinData);
rv = MSCVerifyPIN(pConnection, (MSCUChar8) pinNumber,
(MSCUChar8 *) pinData, pinSize);
}
@@ -1510,10 +1695,11 @@
void doUnblockPIN(int pinNumber)
{
MSCLong32 rv = 0;
- MSCULong32 pinSize;
+ MSCULong32 pinSize, newPinSize;
int usePinpad = 0;
MSCULong32 dummy, units;
MSCUChar8 pinData[17];
+ MSCUChar8 newPinData[17];
CHECK_ERR(pConnection == 0, "Must Connect First !");
#ifdef VERSION2
@@ -1527,15 +1713,24 @@
if (usePinpad) {
printf("Unblock PIN at card terminal.\n");
rv = MSCUnblockPIN(pConnection, (MSCUChar8) pinNumber,
- NULL, 0);
+ NULL, 0, NULL, 0);
}
else {
- rv = getStringValue("Enter unblock PIN", "Enter PIN", pinData, 17);
+ rv = getStringValue("Enter unblock PIN", "Enter PIN", (char *)pinData, 17);
if (rv == 0)
goto abort;
- pinSize = strlen(pinData);
+ pinSize = strlen((char *)pinData);
+#ifdef VERSION2
+ rv = getStringValue("Enter new PIN", "Enter PIN", (char *)newPinData, 17);
+ if (rv == 0)
+ goto abort;
+ newPinSize = strlen((char *)newPinData);
rv = MSCUnblockPIN(pConnection, (MSCUChar8) pinNumber,
+ (MSCUChar8 *) pinData, pinSize, newPinData, newPinSize);
+#else
+ rv = MSCUnblockPIN(pConnection, (MSCUChar8) pinNumber,
(MSCUChar8 *) pinData, pinSize);
+#endif
}
CHECK_ERR(rv != MSC_SUCCESS, "UnblockPIN Failed !");
@@ -1624,18 +1819,18 @@
pinMaxSize = 16;
}
#endif
- rv = getStringValue("Enter old PIN", "Enter PIN", pinData, 17);
+ rv = getStringValue("Enter old PIN", "Enter PIN", (char *)pinData, 17);
if (rv == 0)
goto abort;
- pinSize = strlen(pinData);
+ pinSize = strlen((char *)pinData);
snprintf(dummyString, 32, "Enter new PIN (max %d)", pinMaxSize);
- rv = getStringValue(dummyString, "Enter PIN", newPinData, 17);
+ rv = getStringValue(dummyString, "Enter PIN", (char *)newPinData, 17);
if (rv == 0)
goto abort;
- newPinSize = strlen(newPinData);
+ newPinSize = strlen((char *)newPinData);
rv = MSCChangePIN(pConnection, (MSCUChar8) pinNumber,
(MSCUChar8 *) pinData, (MSCUChar8)pinSize, (MSCUChar8 *) newPinData, (MSCUChar8)newPinSize);
@@ -1672,18 +1867,23 @@
MSCLong32 rv = 0;
MSCObjectACL objectACL;
+ unsigned long readPerm = 0, writePerm = 0, deletePerm = 0;
+
printf("doCreate(%s, %d)\n", objectID, objectSize);
CHECK_ERR(pConnection == 0, "Must Connect First !");
- rv = getNumberValue("Enter the ACL for reading the object\nExample: 0xFFFF for all users", "Enter ACL mask", (unsigned long *)&objectACL.readPermission);
+ rv = getNumberValue("Enter the ACL for reading the object\nExample: 0xFFFF for all users", "Enter ACL mask", &readPerm);
+ objectACL.readPermission = (MSCUShort16)readPerm;
if (rv == 0)
goto abort;
- rv = getNumberValue("Enter the ACL for writing the object\nExample: 0x0002 for user PIN #1", "Enter ACL mask", (unsigned long *)&objectACL.writePermission);
+ rv = getNumberValue("Enter the ACL for writing the object\nExample: 0x0002 for user PIN #1", "Enter ACL mask", &writePerm);
+ objectACL.writePermission = (MSCUShort16)writePerm;
if (rv == 0)
goto abort;
- rv = getNumberValue("Enter the ACL for deleting the object\nExample: 0x0002 for user PIN #1", "Enter ACL mask", (unsigned long *)&objectACL.deletePermission);
+ rv = getNumberValue("Enter the ACL for deleting the object\nExample: 0x0002 for user PIN #1", "Enter ACL mask", &deletePerm);
+ objectACL.deletePermission = (MSCUShort16)deletePerm;
if (rv == 0)
goto abort;
@@ -1944,6 +2144,7 @@
MSCCryptInit cryptInit;
MSCKeyInfo keyInfo;
MSCULong32 keySize;
+ MSCULong32 dummySize = 0;
MSCUChar8 keyType;
MSCULong32 i=0;
MSCULong32 inputBlockSize = 0;
@@ -1975,10 +2176,11 @@
};
#endif
#ifdef VERSION2
- char *rsaCiph [4] = {"RSA with no padding",
+ char *rsaCiph [5] = {"RSA with no padding",
"RSA with PKCS#1 padding",
"RSA with ISO 9796 padding",
- "RSA with ISO 14888"};
+ "RSA with ISO 14888 padding",
+ "RSA with PKCS#1-OAEP padding"};
#else
char *rsaCiph [2] = {"RSA with no padding",
"RSA with PKCS#1 padding"};
@@ -1989,34 +2191,40 @@
char *aesSign [1] = {"AES with blocksize 128 in CBC mode"};
char *aesCiph [2] = {"AES with block size 128 in CBC mode with no padding",
"AES with block size 128 in ECB mode with no padding"};
+ char *ecSign [1] = {"ECDSA with SHA-1 hash"};
#endif
#ifdef VERSION2
- char *rsaSign [7] = {"RSA with MD5 hash and PKCS#1 padding",
+ char *rsaSign [10] = {"RSA with MD5 hash and PKCS#1 padding",
"RSA with SHA-1 hash and PKCS#1 padding",
"RSA with SHA-1 hash and ISO 9796 padding",
"RSA with RIPE MD-160 hash and ISO 9796 padding",
"RSA with RIPE MD-160 hash and PKCS#1 padding",
"RSA with SHA-1 hash and RFC2409 padding",
"RSA with MD5 hash and RFC 2409 padding"
+ "RSA with MD5 hash and PKCS#1-PSS padding",
+ "RSA with RIPE MD-160 hash PKCS#1-PSS padding",
+ "RSA with SHA-1 hash and PKCS#1-PSS padding"
};
#else
char *rsaSign [1] = {"RSA with MD5 hash and PKCS#1 padding",
};
#endif
#ifdef VERSION2
- char *desSign [8] = {"DES 4 byte MAC with no padding",
+ char *desSign [10] = {"DES 4 byte MAC with no padding",
"DES 4 short MAC with ISO 9797 method 1 padding",
"DES 4 short MAC with ISO 9797 method 2 padding",
"DES 4 short MAC mode with PKCS#5 padding",
"DES 8 short MAC with no padding",
"DES 8 short MAC with ISO 9797 method 1 padding",
"DES 8 short MAC with ISO 9797 method 2 padding",
- "DES 8 short MAC mode with PKCS#5 padding"
+ "DES 8 short MAC mode with PKCS#5 padding",
+ "4-byte MAC using a 2-key DES3 according to ISO9797-1 MAC algorithm 3 with method2",
+ "8-byte MAC using a 2-key DES3 key according to ISO9797-1 MAC algorithm 3 with method2"
};
#endif
- int ciphDir;
- int ciphMode;
+ int ciphDir = 0;
+ int ciphMode = 0;
CHECK_ERR(pConnection == 0, "Must Connect First !");
@@ -2063,6 +2271,10 @@
}
#endif
break;
+#ifdef VERSION2
+ case MSC_KEY_EC_F2M_PRIVATE:
+ case MSC_KEY_EC_FP_PRIVATE:
+#endif
case MSC_KEY_DSA_PRIVATE:
choice = getChoice("Would you like to: ", "Choose", s, 1);
switch (choice) {
@@ -2072,6 +2284,10 @@
default: goto abort;
}
break;
+#ifdef VERSION2
+ case MSC_KEY_EC_F2M_PUBLIC:
+ case MSC_KEY_EC_FP_PUBLIC:
+#endif
case MSC_KEY_DSA_PUBLIC:
choice = getChoice("Would you like to: ", "Choose", v, 1);
switch (choice) {
@@ -2120,26 +2336,44 @@
}
if (inFileName == NULL) {
- rv = getStringValue("Please enter text in hexadecimal ASCII (at most 1023 characters)\nExample: 30313233 for 0123\n", "Enter text", hexString, sizeof(hexString));
+ if (ciphDir == MSC_DIR_VERIFY || ciphDir == MSC_DIR_SIGN) {
+ rv = getStringValue("Please enter text to sign in hexadecimal ASCII (at most 1023 characters)\nExample: 30313233 for 0123\n", "Enter text", hexString, sizeof(hexString));
+ }
+ else if (ciphDir == MSC_DIR_ENCRYPT) {
+ rv = getStringValue("Please enter text to encrypt in hexadecimal ASCII (at most 1023 characters)\nExample: 30313233 for 0123\n", "Enter text", hexString, sizeof(hexString));
+ }
+ else if (ciphDir == MSC_DIR_DECRYPT) {
+ rv = getStringValue("Please enter text to decrypt in hexadecimal ASCII (at most 1023 characters)\nExample: 30313233 for 0123\n", "Enter text", hexString, sizeof(hexString));
+ }
if (rv == 0)
goto abort;
/* Calculating multiple of block size */
- inputBlockSize = (((strlen(hexString) / 2) * 8) + keySize - (((strlen(hexString) / 2) * 8) % keySize))/8;
- if ((((strlen(hexString) / 2) * 8) % keySize) == 0)
- inputBlockSize--;
- inCryptData = (MSCUChar8 *)malloc(sizeof(unsigned char)*inputBlockSize);
+ dummySize = keySize;
+ if (keySize % 8 != 0) {
+ dummySize += (8-(keySize % 8));
+ }
+ inputBlockSize = (((strlen(hexString) / 2) * 8) + dummySize - (((strlen(hexString) / 2) * 8) % dummySize))/8;
+ if ((((strlen(hexString) / 2) * 8) % dummySize) == 0)
+ inputBlockSize-=(dummySize/8);
+
+ inCryptData = (MSCUChar8 *)malloc(sizeof(MSCUChar8)*inputBlockSize);
/* I assume input block length = output block length */
- outCryptData = (MSCUChar8 *)malloc(sizeof(unsigned char)*inputBlockSize);
+ outCryptData = (MSCUChar8 *)malloc(sizeof(MSCUChar8)*inputBlockSize);
- inDataSize = hexToBin(hexString, inCryptData);
+ inDataSize = hexToBin((MSCUChar8 *)hexString, inCryptData);
+ outDataSize = inputBlockSize;
+
if (ciphDir == MSC_DIR_VERIFY) {
- rv = getStringValue("Please enter text to verify in hexadecimal ASCII (at most 1023 characters)\nExample: 30313233 for 0123\n", "Enter text", hexString, sizeof(hexString));
+ rv = getStringValue("Please enter signature to verify in hexadecimal ASCII (at most 1023 characters)\nExample: 30313233 for 0123\n", "Enter text", hexString, sizeof(hexString));
if (rv == 0)
goto abort;
- outDataSize = hexToBin(hexString, outCryptData);
+ if ((strlen(hexString)/2 + 1) > outDataSize) {
+ realloc(outCryptData, sizeof(MSCUChar8)*(strlen(hexString)/2 + 1));
+ }
+ outDataSize = hexToBin((MSCUChar8 *)hexString, outCryptData);
}
}
else {
@@ -2161,11 +2395,15 @@
fileSize = ftell(inFile);
#endif
/* Calculating multiple of block size */
- inputBlockSize = ((fileSize * 8) + keySize - ((fileSize * 8) % keySize))/8;
- if (((fileSize * 8) % keySize) == 0)
- inputBlockSize--;
+ dummySize = keySize;
+ if (keySize % 8 != 0) {
+ dummySize += (keySize % 8);
+ }
+ inputBlockSize = (fileSize*8 + dummySize - ((fileSize*8) % dummySize))/8;
+ if (((fileSize * 8) % dummySize) == 0)
+ inputBlockSize-=(dummySize/8);
- inCryptData = (MSCUChar8 *)malloc(sizeof(unsigned char)*inputBlockSize);
+ inCryptData = (MSCUChar8 *)malloc(sizeof(MSCUChar8)*inputBlockSize);
read = fread(inCryptData, sizeof(MSCUChar8), fileSize, inFile);
if (ferror(inFile)) {
printf("ERR: Error reading file\n");
@@ -2174,13 +2412,17 @@
inDataSize = read;
/* I assume input block length = output block length */
- outCryptData = (MSCUChar8 *)malloc(sizeof(unsigned char)*inputBlockSize);
+ outCryptData = (MSCUChar8 *)malloc(sizeof(MSCUChar8)*inputBlockSize);
+ outDataSize = inputBlockSize;
if (ciphDir == MSC_DIR_VERIFY) {
- rv = getStringValue("Please enter text to verify in hexadecimal ASCII (at most 1023 characters)\nExample: 30313233 for 0123\n", "Enter text", hexString, sizeof(hexString));
+ rv = getStringValue("Please enter signature to verify in hexadecimal ASCII (at most 1023 characters)\nExample: 30313233 for 0123\n", "Enter text", hexString, sizeof(hexString));
if (rv == 0)
goto abort;
- outDataSize = hexToBin(hexString, outCryptData);
+ if ((strlen(hexString)/2 + 1) > outDataSize) {
+ realloc(outCryptData, sizeof(MSCUChar8)*(strlen(hexString)/2 + 1));
+ }
+ outDataSize = hexToBin((MSCUChar8 *)hexString, outCryptData);
}
}
@@ -2257,6 +2499,7 @@
inDataSize = inputBlockSize;
ciphMode = MSC_MODE_CIPHER_AES_BLOCK_128_ECB_NOPAD;
break;
+ default: goto abort;
}
break;
#endif
@@ -2264,7 +2507,7 @@
case MSC_KEY_RSA_PRIVATE_CRT:
case MSC_KEY_RSA_PUBLIC:
#ifdef VERSION2
- choice = getChoice("Select the algorithm: ", "Choose", rsaCiph, 4);
+ choice = getChoice("Select the algorithm: ", "Choose", rsaCiph, 5);
switch (choice) {
case 1: ciphMode = MSC_MODE_CIPHER_RSA_NOPAD;
/* Padding for algoritm with no padding
@@ -2282,6 +2525,8 @@
break;
case 4: ciphMode = MSC_MODE_CIPHER_RSA_ISO14888;
break;
+ case 5: ciphMode = MSC_MODE_CIPHER_RSA_PKCS1_OAEP;
+ break;
default:
goto abort;
}
@@ -2315,7 +2560,7 @@
case MSC_KEY_3DES:
case MSC_KEY_3DES3:
case MSC_KEY_DES:
- choice = getChoice("Select the algorithm: ", "Choose", desSign, 8);
+ choice = getChoice("Select the algorithm: ", "Choose", desSign, 10);
switch(choice) {
case 1: ciphMode = MSC_MODE_SIGNATURE_DES_MAC4_NOPAD;
/* Padding for algoritm with no padding
@@ -2341,6 +2586,10 @@
break;
case 8: ciphMode = MSC_MODE_SIGNATURE_DES_MAC8_PKCS5;
break;
+ case 9: ciphMode = MSC_MODE_SIGNATURE_DES_MAC4_ISO9797_1_M2_ALG3;
+ break;
+ case 10: ciphMode = MSC_MODE_SIGNATURE_DES_MAC8_ISO9797_1_M2_ALG3;
+ break;
default:
goto abort;
}
@@ -2362,7 +2611,7 @@
case MSC_KEY_RSA_PRIVATE_CRT:
case MSC_KEY_RSA_PUBLIC:
#ifdef VERSION2
- choice = getChoice("Select the algorithm: ", "Choose", rsaSign, 7);
+ choice = getChoice("Select the algorithm: ", "Choose", rsaSign, 10);
switch (choice) {
case 1: ciphMode = MSC_MODE_SIGNATURE_RSA_MD5_PKCS1;
break;
@@ -2378,6 +2627,12 @@
break;
case 7: ciphMode = MSC_MODE_SIGNATURE_RSA_MD5_RFC2409;
break;
+ case 8: ciphMode = MSC_MODE_SIGNATURE_RSA_MD5_PKCS1_PSS;
+ break;
+ case 9: ciphMode = MSC_MODE_SIGNATURE_RSA_RIPEMD160_PKCS1_PSS;
+ break;
+ case 10: ciphMode = MSC_MODE_SIGNATURE_RSA_SHA_PKCS1_PSS;
+ break;
default:
goto abort;
}
@@ -2392,6 +2647,23 @@
}
break;
#endif
+#ifdef VERSION2
+ case MSC_KEY_EC_F2M_PRIVATE:
+ case MSC_KEY_EC_FP_PRIVATE:
+ case MSC_KEY_EC_FP_PUBLIC:
+ case MSC_KEY_EC_F2M_PUBLIC:
+ choice = getChoice("Select the algorithm: ", "Choose", ecSign, 1);
+ switch(choice) {
+ case 1: ciphMode = MSC_MODE_SIGNATURE_ECDSA_SHA;
+ if (6 + (2 * ((keySize / 8) + 1)) > outDataSize) {
+ realloc(outCryptData, sizeof(MSCUChar8)* (6 + (2 * ((keySize / 8) + 1))));
+ }
+ break;
+ default:
+ goto abort;
+ }
+ break;
+#endif
case MSC_KEY_DSA_PUBLIC:
case MSC_KEY_DSA_PRIVATE:
choice = getChoice("Select the algorithm: ", "Choose", dsaSign, 1);
@@ -2423,21 +2695,31 @@
if (outFileName == NULL) {
printf("Result : ");
- for (i = 0; i < outDataSize; i++)
- printf("%02X", outCryptData[i]);
+ if (ciphDir == MSC_DIR_VERIFY) {
+ printf("Signature valid.");
+ }
+ else {
+ for (i = 0; i < outDataSize; i++)
+ printf("%02X", outCryptData[i]);
+ }
printf("\n");
}
else {
long written = 0;
- outFile = fopen(outFileName, "w");
- if (outFile == NULL) {
- printf("ERR: Cannot open outfile\n");
- goto end;
+ if (ciphDir == MSC_DIR_VERIFY) {
+ printf("Signature valid.");
}
- written = fwrite(outCryptData, sizeof(MSCUChar8), outDataSize, outFile);
- if (ferror(outFile)) {
- printf("ERR: Error writing outfile\n");
- goto end;
+ else {
+ outFile = fopen(outFileName, "w");
+ if (outFile == NULL) {
+ printf("ERR: Cannot open outfile\n");
+ goto end;
+ }
+ written = fwrite(outCryptData, sizeof(MSCUChar8), outDataSize, outFile);
+ if (ferror(outFile)) {
+ printf("ERR: Error writing outfile\n");
+ goto end;
+ }
}
}
@@ -2502,6 +2784,18 @@
case MSC_KEY_AES:
printf("%16s", "AES");
break;
+ case MSC_KEY_EC_F2M_PRIVATE:
+ printf("%16s", "EC F2M PRIVATE");
+ break;
+ case MSC_KEY_EC_F2M_PUBLIC:
+ printf("%16s", "EC F2M PUBLIC");
+ break;
+ case MSC_KEY_EC_FP_PRIVATE:
+ printf("%16s", "EC FP PRIVATE");
+ break;
+ case MSC_KEY_EC_FP_PUBLIC:
+ printf("%16s", "EC FP PUBLIC");
+ break;
#endif
}
@@ -2563,6 +2857,18 @@
case MSC_KEY_AES:
printf("%16s", "AES");
break;
+ case MSC_KEY_EC_F2M_PRIVATE:
+ printf("%16s", "EC F2M PRIVATE");
+ break;
+ case MSC_KEY_EC_F2M_PUBLIC:
+ printf("%16s", "EC F2M PUBLIC");
+ break;
+ case MSC_KEY_EC_FP_PRIVATE:
+ printf("%16s", "EC FP PRIVATE");
+ break;
+ case MSC_KEY_EC_FP_PUBLIC:
+ printf("%16s", "EC FP PUBLIC");
+ break;
#endif
}
@@ -2631,7 +2937,7 @@
MSCKeyACL keyACL;
MSCKeyPolicy keyPolicy;
MSCPUChar8 objectData;
- MSCUShort16 readACL, writeACL, useACL;
+ unsigned long readACL, writeACL, useACL;
MSCULong32 dataSize;
struct stat fileStat;
FILE *fp = NULL;
@@ -2673,21 +2979,21 @@
keyPolicy.cipherMode = 0xFFFF;
#endif
- rv = getNumberValue("Enter the ACL for reading the key", "Enter ACL mask", (unsigned long *)&readACL);
+ rv = getNumberValue("Enter the ACL for reading the key", "Enter ACL mask", &readACL);
if (rv == 0)
goto abort;
- rv = getNumberValue("Enter the ACL for writing the key", "Enter ACL mask", (unsigned long *)&writeACL);
+ rv = getNumberValue("Enter the ACL for writing the key", "Enter ACL mask", &writeACL);
if (rv == 0)
goto abort;
- rv = getNumberValue("Enter the ACL for using the key", "Enter ACL mask", (unsigned long *)&useACL);
+ rv = getNumberValue("Enter the ACL for using the key", "Enter ACL mask", &useACL);
if (rv == 0)
goto abort;
- keyACL.readPermission = readACL;
- keyACL.writePermission = writeACL;
- keyACL.usePermission = useACL;
+ keyACL.readPermission = (MSCUShort16)readACL;
+ keyACL.writePermission = (MSCUShort16)writeACL;
+ keyACL.usePermission = (MSCUShort16)useACL;
rv = MSCImportKey(pConnection, (MSCUChar8) keyNumber,
&keyACL, objectData, dataSize, &keyPolicy, 0, 0);
@@ -2708,16 +3014,30 @@
void doGenKeys(char *keyType, int keySize )
{
MSC_RV rv = 0;
- MSCUChar8 prvKeyNum, pubKeyNum;
+ unsigned long prvKeyNum=0, pubKeyNum=0;
MSCGenKeyParams keyParams;
pthread_t pthThread;
- int prvReadACL, prvWriteACL, prvUseACL, pubReadACL, pubWriteACL, pubUseACL;
+ unsigned long prvReadACL=0, prvWriteACL=0, prvUseACL=0, pubReadACL=0, pubWriteACL=0, pubUseACL=0;
int choice;
char algorithm[8];
CHECK_ERR(pConnection == 0, "Must Connect First !");
keyParams.algoType = 0;
+#ifdef VERSION2
+ if (strcmp(keyType, "ecfp") == 0) {
+ keyParams.algoType = MSC_GEN_ALG_EC_FP;
+ strcpy(algorithm, "EC FP\0");
+ }
+ if (strcmp(keyType, "ecf2m") == 0) {
+ keyParams.algoType = MSC_GEN_ALG_EC_F2M;
+ strcpy(algorithm, "EC F2M\0");
+ }
+ else if (strcmp(keyType, "aes") == 0) {
+ keyParams.algoType = MSC_GEN_ALG_AES;
+ strcpy(algorithm, "AES\0");
+ }
+#endif
if (strcmp(keyType, "rsacrt") == 0) {
keyParams.algoType = MSC_GEN_ALG_RSA_CRT;
strcpy(algorithm, "RSA CRT\0");
@@ -2730,6 +3050,18 @@
keyParams.algoType = MSC_GEN_ALG_RSA;
strcpy(algorithm, "RSA\0");
}
+ else if (strcmp(keyType, "des") == 0) {
+ keyParams.algoType = MSC_GEN_ALG_DES;
+ strcpy(algorithm, "DES\0");
+ }
+ else if (strcmp(keyType, "3des") == 0) {
+ keyParams.algoType = MSC_GEN_ALG_3DES;
+ strcpy(algorithm, "3DES\0");
+ }
+ else if (strcmp(keyType, "3des3") == 0) {
+ keyParams.algoType = MSC_GEN_ALG_3DES3;
+ strcpy(algorithm, "3DES3\0");
+ }
#ifdef VERSION2
keyParams.privateKeyPolicy.cipherDirection = MSC_KEYPOLICY_DIR_ANY;
@@ -2756,46 +3088,70 @@
printf(" using the %s algorithm for generation.\n", algorithm);
printf("**********************************************************\n");
- rv = getNumberValue("Enter the public key number", "Enter key number", (unsigned long *)&pubKeyNum);
- if (rv == 0)
- goto abort;
+ if (keyParams.algoType == MSC_GEN_ALG_RSA_CRT || keyParams.algoType == MSC_GEN_ALG_RSA || keyParams.algoType == MSC_GEN_ALG_DSA
+#ifdef VERSION2
+ || keyParams.algoType == MSC_GEN_ALG_EC_F2M || keyParams.algoType == MSC_GEN_ALG_EC_FP
+#endif
+ ) {
+ rv = getNumberValue("Enter the public key number", "Enter key number", &pubKeyNum);
+ if (rv == 0)
+ goto abort;
- rv = getNumberValue("Enter the private key number", "Enter key number", (unsigned long *)&prvKeyNum);
- if (rv == 0)
- goto abort;
+ rv = getNumberValue("Enter the private key number", "Enter key number", &prvKeyNum);
+ if (rv == 0)
+ goto abort;
- rv = getNumberValue("Enter the ACL for reading the public key\nExample: 0x0002 for user PIN #1", "Enter ACL mask", (unsigned long *)&pubReadACL);
- if (rv == 0)
- goto abort;
+ rv = getNumberValue("Enter the ACL for reading the public key\nExample: 0x0002 for user PIN #1", "Enter ACL mask", &pubReadACL);
+ if (rv == 0)
+ goto abort;
- rv = getNumberValue("Enter the ACL for deleting the public key\nExample: 0x0002 for user PIN #1", "Enter ACL mask", (unsigned long *)&pubWriteACL);
- if (rv == 0)
- goto abort;
+ rv = getNumberValue("Enter the ACL for deleting the public key\nExample: 0x0002 for user PIN #1", "Enter ACL mask", &pubWriteACL);
+ if (rv == 0)
+ goto abort;
- rv = getNumberValue("Enter the ACL for using the public key\nExample: 0xFFFF for all users", "Enter ACL mask", (unsigned long *)&pubUseACL);
- if (rv == 0)
- goto abort;
+ rv = getNumberValue("Enter the ACL for using the public key\nExample: 0xFFFF for all users", "Enter ACL mask", &pubUseACL);
+ if (rv == 0)
+ goto abort;
- rv = getNumberValue("Enter the ACL for reading the private key\nExample: 0x0000 for nobody", "Enter ACL mask", (unsigned long *)&prvReadACL);
- if (rv == 0)
- goto abort;
+ rv = getNumberValue("Enter the ACL for reading the private key\nExample: 0x0000 for nobody", "Enter ACL mask", &prvReadACL);
+ if (rv == 0)
+ goto abort;
- rv = getNumberValue("Enter the ACL for deleting the private key\nExample: 0x0002 for user PIN #1", "Enter ACL mask", (unsigned long *)&prvWriteACL);
- if (rv == 0)
- goto abort;
+ rv = getNumberValue("Enter the ACL for deleting the private key\nExample: 0x0002 for user PIN #1", "Enter ACL mask", &prvWriteACL);
+ if (rv == 0)
+ goto abort;
- rv = getNumberValue("Enter the ACL for using the private key\nExample: 0x0002 for user PIN #1", "Enter ACL mask", (unsigned long *)&prvUseACL);
- if (rv == 0)
- goto abort;
+ rv = getNumberValue("Enter the ACL for using the private key\nExample: 0x0002 for user PIN #1", "Enter ACL mask", &prvUseACL);
+ if (rv == 0)
+ goto abort;
+ }
+ else {
+ rv = getNumberValue("Enter the secret key number", "Enter key number", (unsigned long *)&pubKeyNum);
+ if (rv == 0)
+ goto abort;
- keyParams.privateKeyACL.readPermission = prvReadACL;
- keyParams.privateKeyACL.writePermission = prvWriteACL;
- keyParams.privateKeyACL.usePermission = prvUseACL;
+ rv = getNumberValue("Enter the ACL for reading the secret key\nExample: 0x0000 for nobody", "Enter ACL mask", (unsigned long *)&pubReadACL);
+ if (rv == 0)
+ goto abort;
- keyParams.publicKeyACL.readPermission = pubReadACL;
- keyParams.publicKeyACL.writePermission = pubWriteACL;
- keyParams.publicKeyACL.usePermission = pubUseACL;
+ rv = getNumberValue("Enter the ACL for deleting the secret key\nExample: 0x0002 for user PIN #1", "Enter ACL mask", (unsigned long *)&pubWriteACL);
+ if (rv == 0)
+ goto abort;
+ rv = getNumberValue("Enter the ACL for using the secret key\nExample: 0x0002 for user PIN #1", "Enter ACL mask", (unsigned long *)&pubUseACL);
+ if (rv == 0)
+ goto abort;
+
+ }
+
+ keyParams.privateKeyACL.readPermission = (MSCUShort16)prvReadACL;
+ keyParams.privateKeyACL.writePermission = (MSCUShort16)prvWriteACL;
+ keyParams.privateKeyACL.usePermission = (MSCUShort16)prvUseACL;
+
+ keyParams.publicKeyACL.readPermission = (MSCUShort16)pubReadACL;
+ keyParams.publicKeyACL.writePermission = (MSCUShort16)pubWriteACL;
+ keyParams.publicKeyACL.usePermission = (MSCUShort16)pubUseACL;
+
{
char *choices[2] = {"YES", "NO"};
choice = getChoice("Are you sure ?", "Choose", choices, 2);
@@ -2813,7 +3169,7 @@
fflush(stdout);
fflush(stdin);
- rv = MSCGenerateKeys(pConnection, prvKeyNum, pubKeyNum, &keyParams);
+ rv = MSCGenerateKeys(pConnection, (MSCUChar8)prvKeyNum, (MSCUChar8)pubKeyNum, &keyParams);
quitStat = 1;
if (pthread_join(pthThread, NULL) != 0)
@@ -2869,9 +3225,9 @@
MSCUChar8 pinMinSize;
MSCULong32 dummy;
- MSCUShort16 pinACL;
- MSCUShort16 keyACL;
- MSCUShort16 objectACL;
+ unsigned long pinACL;
+ unsigned long keyACL;
+ unsigned long objectACL;
#ifdef VERSION2
MSCULong32 pinPolicyChoice;
MSCULong32 pinSizePolicyChoice;
@@ -2956,11 +3312,13 @@
{
pinPolicies |= MSC_PIN_POLICY_SIZE;
snprintf(dummyString, sizeof(dummyString), "Enter the maximal PIN size (max. %d)", pinMaxSize);
- rv = getNumberValue(dummyString, "Enter PIN size", (unsigned long *)&pinMaxSize);
+ rv = getNumberValue(dummyString, "Enter PIN size", &dummy);
+ pinMaxSize = (MSCUChar8)dummy;
if (rv == 0)
goto abort;
snprintf(dummyString, sizeof(dummyString), "Enter the minimal PIN size (max. %d)", pinMaxSize);
- rv = getNumberValue(dummyString, "Enter PIN size", (unsigned long *)&pinMinSize);
+ rv = getNumberValue(dummyString, "Enter PIN size", &dummy);
+ pinMinSize = (MSCUChar8)dummy;
if (rv == 0)
goto abort;
}
@@ -3034,7 +3392,7 @@
}
#endif
- rv = getStringValue("Please enter your admin PIN (PIN #0)", "Enter admin PIN", adminPIN, 17);
+ rv = getStringValue("Please enter your admin PIN (PIN #0)", "Enter admin PIN", (char *)adminPIN, 17);
if (rv == 0)
goto abort;
#ifdef VERSION2
@@ -3042,7 +3400,7 @@
if (rv == 0)
goto abort;
- rv = getStringValue("Please enter your admin unblock PIN (PIN #0)", "Enter admin unblock PIN", adminUnblockPIN, 17);
+ rv = getStringValue("Please enter your admin unblock PIN (PIN #0)", "Enter admin unblock PIN", (char *)adminUnblockPIN, 17);
if (rv == 0)
goto abort;
@@ -3051,7 +3409,7 @@
goto abort;
#endif
- rv = getStringValue("Please enter your user PIN (PIN #1)", "Enter user PIN", userPIN, 17);
+ rv = getStringValue("Please enter your user PIN (PIN #1)", "Enter user PIN", (char *)userPIN, 17);
if (rv == 0)
goto abort;
@@ -3059,7 +3417,7 @@
if (rv == 0)
goto abort;
- rv = getStringValue("Please enter your user unblock PIN (PIN #1)", "Enter user unblock PIN", userUnblockPIN, 17);
+ rv = getStringValue("Please enter your user unblock PIN (PIN #1)", "Enter user unblock PIN", (char *)userUnblockPIN, 17);
if (rv == 0)
goto abort;
@@ -3086,13 +3444,13 @@
transportKey[8] = '\0';
- rv = getNumberValue("Enter the ACL who can create objects\nExample: 0x0002 for user with PIN #1\n", "Enter ACL", (unsigned long *)&objectACL);
+ rv = getNumberValue("Enter the ACL who can create objects\nExample: 0x0002 for user with PIN #1\n", "Enter ACL", &objectACL);
if (rv == 0)
goto abort;
- rv = getNumberValue("Enter the ACL who can create keys\nExample: 0x0002 for user with PIN #1\n", "Enter ACL", (unsigned long *)&keyACL);
+ rv = getNumberValue("Enter the ACL who can create keys\nExample: 0x0002 for user with PIN #1\n", "Enter ACL", &keyACL);
if (rv == 0)
goto abort;
- rv = getNumberValue("Enter the ACL who can create PINs\nExample: 0x0001 for admin with PIN #0\n", "Enter ACL", (unsigned long *)&pinACL);
+ 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;
@@ -3187,13 +3545,13 @@
initParams.defaultCHVUnblockTries = (MSCUChar8) userUnblockPINTries;
initParams.objectMemory = memoryAlloc;
- initParams.createKeysACL = keyACL;
- initParams.createObjectACL = objectACL;
- initParams.createPINsACL = pinACL;
+ initParams.createKeysACL = (MSCUShort16)keyACL;
+ initParams.createObjectACL = (MSCUShort16)objectACL;
+ initParams.createPINsACL = (MSCUShort16)pinACL;
#ifdef VERSION2
initParams.pinPolicies = pinPolicies;
- initParams.pinMaxSize = pinMaxSize;
- initParams.pinMinSize = pinMinSize;
+ initParams.pinMaxSize = (MSCUChar8)pinMaxSize;
+ initParams.pinMinSize = (MSCUChar8)pinMinSize;
initParams.pinCharset = pinCharset;
initParams.pinMixType = pinMixType;
#endif
@@ -3202,11 +3560,12 @@
quitStat = 1;
if (pthread_join(pthThread, NULL) != 0)
- printf("pthread_join error: %s\n", strerror(errno));;
+ printf("pthread_join error: %s\n", strerror(errno));
CHECK_ERR(rv != MSC_SUCCESS, "Format failed !");
printf("Format Successful.\n");
+ goto end;
abort:
printf("Format Cancelled.\n");
Modified: trunk/muscleTool/muscleTool.h
===================================================================
--- trunk/muscleTool/muscleTool.h 2005-08-07 15:52:52 UTC (rev 357)
+++ trunk/muscleTool/muscleTool.h 2005-10-19 22:46:24 UTC (rev 358)
@@ -10,22 +10,23 @@
*
* $Id$
*/
-#ifdef VERSION2
+
+#ifdef _WIN32
#define PACKAGE_VERSION "2.0.0"
-#else
-#define PACKAGE_VERSION "1.0.0"
#endif
void doListTokens();
void doFormat(int tokenNumber);
void doConnect(int tokenNumber);
void doRelease();
+void doMoveKey(int old_key_nb, int new_key_nb);
+void doMove(char *oldObjectID, char *newObjectID);
+void doListPINs();
void doList();
-void doListPINs();
void doListKeys();
void doDeleteKey(int key_nb);
void doStatus();
-void doDeletePIN(int pin_nb);
+void doDeleteID(int pin_nb);
void doLogout();
void doVersion();
void doVerify(int pinNumber);
Modified: trunk/muscleTool/parser.y
===================================================================
--- trunk/muscleTool/parser.y 2005-08-07 15:52:52 UTC (rev 357)
+++ trunk/muscleTool/parser.y 2005-10-19 22:46:24 UTC (rev 358)
@@ -60,9 +60,13 @@
%token RSA
%token RSACRT
%token DSA
+%token EC
+%token ECFP
+%token ECF2M
%token DES
+%token TDES
+%token TDES3
%token AES
-%token TRIPLE_DES
%token KEYS
%token PINS
%token OBJECTS
@@ -72,13 +76,15 @@
%token CHANGEPIN
%token UNBLOCK
%token LISTPINS
-%token DELETEPIN
+%token DELETEID
%token LISTKEYS
%token EXPORTKEY
%token IMPORTKEY
%token GENKEYS
%token DELETEKEY
+%token MOVEKEY
+%token MOVE
%token FORMAT
%token TOKENS
@@ -120,26 +126,36 @@
| CHANGEPIN NUMBER { doChangePIN($2); }
| UNBLOCK NUMBER { doUnblockPIN($2); }
| LISTPINS { doListPINs(); }
- | DELETEPIN NUMBER { doDeletePIN($2); }
+ | DELETEID NUMBER { doDeleteID($2); }
| LISTKEYS { doListKeys(); }
| EXPORTKEY NUMBER STRING { doExportKey($2, $3); }
| IMPORTKEY NUMBER STRING { doImportKey($2, $3); }
| GENKEYS RSA NUMBER { doGenKeys("rsa", $3); }
| GENKEYS DSA NUMBER { doGenKeys("dsa", $3); }
+ | GENKEYS ECFP NUMBER { doGenKeys("ecfp", $3); }
+ | GENKEYS ECF2M NUMBER { doGenKeys("ecf2m", $3); }
| GENKEYS RSACRT NUMBER { doGenKeys("rsacrt", $3); }
+ | GENKEYS DES NUMBER { doGenKeys("des", $3); }
+ | GENKEYS TDES NUMBER { doGenKeys("3des", $3); }
+ | GENKEYS TDES3 NUMBER { doGenKeys("3des3", $3); }
+ | GENKEYS AES NUMBER { doGenKeys("aes", $3); }
| DELETEKEY NUMBER { doDeleteKey($2); }
| FILECRYPT NUMBER STRING STRING { doCrypt($2, $3, $4); }
| CRYPT NUMBER { doCrypt($2, NULL, NULL); }
- | FORMAT NUMBER { doFormat($2); }
+ | FORMAT NUMBER { doFormat($2); }
| TOKENS { doListTokens(); }
- | CONNECT NUMBER { doConnect($2); }
+ | MOVEKEY NUMBER NUMBER { doMoveKey($2, $3); }
+ | MOVE STRING STRING { doMove($2, $3); }
+ | CONNECT NUMBER { doConnect($2); }
| RESUME { doResume(NULL); }
- | RESUME CRYPT { doResume("crypt"); }
+ | RESUME CRYPT { doResume("crypt"); }
| RESUME RSA { doResume("rsa"); }
| RESUME DSA { doResume("dsa"); }
| RESUME DES { doResume("des"); }
+ | RESUME EC { doResume("ec"); }
+ | RESUME TDES { doResume("3des"); }
+ | RESUME TDES3 { doResume("3des3"); }
| RESUME AES { doResume("aes"); }
- | RESUME TRIPLE_DES { doResume("3des"); }
| RESUME KEYS { doResume("keys"); }
| RESUME PINS { doResume("pins"); }
| RESUME OBJECTS { doResume("objects"); }
@@ -166,7 +182,9 @@
| HELP UNBLOCK { help_unblock(); }
| HELP LISTPINS { help_listpins(); }
| HELP LISTKEYS { help_listkeys(); }
- | HELP DELETEPIN { help_deletepin(); }
+ | HELP DELETEID { help_deleteid(); }
+ | HELP MOVEKEY { help_movekey(); }
+ | HELP MOVE { help_move(); }
| HELP EXPORTKEY { help_exportkey(); }
| HELP IMPORTKEY { help_importkey(); }
| HELP GENKEYS { help_genkeys(); }
@@ -179,9 +197,11 @@
| HELP RESUME CRYPT { help_resume_crypt(); }
| HELP RESUME RSA { help_resume_rsa(); }
| HELP RESUME DSA { help_resume_dsa(); }
- | HELP RESUME DES { help_resume_dsa(); }
- | HELP RESUME TRIPLE_DES { help_resume_3des(); }
+ | HELP RESUME DES { help_resume_des(); }
+ | HELP RESUME TDES { help_resume_3des(); }
+ | HELP RESUME TDES3 { help_resume_3des3(); }
| HELP RESUME KEYS { help_resume_keys(); }
+ | HELP RESUME EC { help_resume_ec(); }
| HELP RESUME PINS { help_resume_pins(); }
| HELP RESUME OBJECTS { help_resume_objects(); }
| HELP RELEASE { help_release(); }
Modified: trunk/muscleTool/scanner.l
===================================================================
--- trunk/muscleTool/scanner.l 2005-08-07 15:52:52 UTC (rev 357)
+++ trunk/muscleTool/scanner.l 2005-10-19 22:46:24 UTC (rev 358)
@@ -3,7 +3,8 @@
*
* MUSCLE SmartCard Development ( http://www.linuxnet.com )
*
- * Copyright (C) 2004
+ * Copyright (C) 2005
+ * Karsten Ohme <k_o_ at users.sourceforge.net>
* Toni Andjelkovic <toni at soth.at>
* Ludovic Rousseau <ludovic.rousseau at free.fr>
*
@@ -23,7 +24,7 @@
void my_lex_close(void);
/* silence warnings */
-#ifdef WIN32
+#if defined(_WIN32)
__declspec(dllimport) extern int fileno(FILE *);
#else
extern int fileno(FILE *);
@@ -57,7 +58,11 @@
dsa return DSA;
des return DES;
aes return AES;
-3des return TRIPLE_DES;
+ec return EC;
+ecfp return ECFP;
+ecf2m return ECF2M;
+3des return TDES;
+3des3 return TDES3;
keys return KEYS;
pins return PINS;
objects return OBJECTS;
@@ -67,7 +72,9 @@
changepin return CHANGEPIN;
unblock return UNBLOCK;
listpins return LISTPINS;
-deletepin return DELETEPIN;
+deleteid return DELETEID;
+movekey return MOVEKEY;
+move return MOVE;
listkeys return LISTKEYS;
exportkey return EXPORTKEY;
More information about the Pcsclite-cvs-commit
mailing list