plaintext apdus to be sent via SM can now be read from a file
git-svn-id: https://vsmartcard.svn.sourceforge.net/svnroot/vsmartcard@343 96b47cad-a561-4643-ad3b-153ac7d7599c
This commit is contained in:
@@ -3,7 +3,7 @@ SUBDIRS = src m4 patches
|
||||
|
||||
DISTCLEANFILES = Doxyfile libpace.pc
|
||||
|
||||
EXTRA_DIST = README.dox libpace.pc.in Doxyfile.in
|
||||
EXTRA_DIST = README.dox libpace.pc.in Doxyfile.in apdus
|
||||
|
||||
do_subst = sed \
|
||||
-e 's,[@]PACKAGE_NAME[@],$(PACKAGE_NAME),g' \
|
||||
|
||||
@@ -40,7 +40,8 @@ If you only use pace-tool for testing your card, you don't need gadgetfs.
|
||||
|
||||
If ccid runs into a checking error, because the Le field of the APDU is 0 (as
|
||||
set for the General Authenticate APDU during PACE), you need to patch libopensc
|
||||
(see http://www.opensc-project.org/opensc/ticket/209)
|
||||
(see http://www.opensc-project.org/opensc/ticket/209). Such an error looks something like this:
|
||||
[default] apdu.c:343:sc_check_apdu: Invalid Case 4 short APDU: cse=04 cla=0c ins=2a p1=00 p2=be lc=351 le=0
|
||||
|
||||
|
||||
@section u USAGE
|
||||
@@ -48,10 +49,8 @@ set for the General Authenticate APDU during PACE), you need to patch libopensc
|
||||
When testing PACE with either PIN, CAN, MRZ or PUK run pace-tool. Here you can
|
||||
enter APDUs which are to be converted according to the secure messaging
|
||||
parameter and to be sent to the card. Herefor insert the APDU in hex (upper or
|
||||
lower case) with a colon to separate the bytes or without it. So to read the
|
||||
current selected file both of these forms would be valid:
|
||||
00:b0:02:00:00
|
||||
00B0020000
|
||||
lower case) with a colon to separate the bytes or without it. Example APDUs can
|
||||
be found in the file apdus.
|
||||
To pass a secret to pace-tool, the command line parameters or the environment
|
||||
variables PIN/CAN/MRZ/PUK/NEWPIN can be used. If none of these options is used,
|
||||
pace-tool will show a password prompt.
|
||||
|
||||
28
ccid/apdus
Normal file
28
ccid/apdus
Normal file
@@ -0,0 +1,28 @@
|
||||
00:22:81:B6:0F:83:0D:5A:5A:43:56:43:41:41:54:41:30:30:30:31
|
||||
00:2a:00:be:e4:7f:4e:81:9d:5f:29:01:00:42:0d:5a:5a:43:56:43:41:41:54:41:30:30:30:31:7f:49:4f:06:0a:04:00:7f:00:07:02:02:02:02:03:86:41:04:52:dd:32:ea:fe:1f:bb:b4:00:0c:d9:ce:75:f6:66:36:cf:cf:1e:dd:44:f7:b1:ed:ae:25:b8:41:93:da:04:a9:1c:77:ee:87:f5:c8:f9:59:ed:27:62:00:de:33:ab:57:4c:e9:80:11:35:ff:44:97:a3:71:62:b7:c8:54:8a:0c:5f:20:0e:5a:5a:44:56:43:41:41:54:41:30:30:30:30:35:7f:4c:12:06:09:04:00:7f:00:07:03:01:02:02:53:05:70:03:01:ff:b7:5f:25:06:01:00:00:06:01:01:5f:24:06:01:00:01:00:03:01:5f:37:40:6f:13:ae:9a:6f:4e:dd:b7:83:9f:f3:f0:4d:71:e0:dc:37:7b:c4:b0:8f:ad:29:5e:ed:24:1b:52:43:28:ad:07:30:eb:55:34:97:b4:fb:66:e9:bb:7a:b9:08:15:f0:42:73:f0:9e:75:1d:7f:d4:b8:61:43:9b:4e:e6:53:81:c3
|
||||
002281B610830E5A5A445643414154413030303035
|
||||
002a00be0001417f4e81fa5f290100420e5a5a4456434141544130303030357f494f060a04007f000702020202038641049bfe7415d73c4a78d60b2cc1bca11b6d5e523969acfb5b756a3be1551b22239c79ae362b838b00669983c0caf6ed0c781d401c95d2b32857de8ce1b619dac4a75f200a5a5a5349543030304f347f4c12060904007f000703010202530500000000045f25060100000902015f2406010000090206655e732d060904007f0007030103028020b02baa51a94fac0954df204d61fe22da1d408d45db4aa1d70e600dad4faf6799732d060904007f0007030103018020c72e13582f01ba068dd1aac29a2428c0c54ab9c204fd53b3f13e8290e21e50f95f374083c5b441fec5b18efd1caa4a11b8e1cede0a8b42d442f00d7f604e429f339b4e3e6c06f9e76a2daa82c1722ee137a89038b969c634561581e6c26d9f6fa75c52
|
||||
00:22:81:A4:53:80:0A:04:00:7F:00:07:02:02:02:02:03:83:0A:5A:5A:53:49:54:30:30:30:4F:34:91:20:88:E5:F2:C6:11:18:0D:0A:C1:0E:BD:E6:FC:2A:5E:62:41:79:C0:A5:77:C3:E4:88:52:DD:81:A4:CD:F7:90:51:67:17:73:15:06:09:04:00:7F:00:07:03:01:04:02:53:08:32:30:31:30:30:39:32:34
|
||||
00:84:00:00:08
|
||||
00820000400C9E7DB72CB0FAEA15B00FECAE0257546446A9395862239AF240C3C29E857F8403345817760FE13F6597F04D2F7330B59065F68DF71EF7FDEC86743CDE2869DD
|
||||
00a4000c023f00
|
||||
00:A4:02:0C:02:01:1D
|
||||
00:b0:00:00:80
|
||||
00B0008080
|
||||
00b0010080
|
||||
00:B0:01:80:80
|
||||
00:b0:02:00:80
|
||||
00B0028080
|
||||
00b0030080
|
||||
00:B0:03:80:80
|
||||
00:b0:04:00:80
|
||||
00B0048080
|
||||
00b0050080
|
||||
00:B0:05:80:80
|
||||
00:b0:06:00:80
|
||||
00B0068080
|
||||
00b0070080
|
||||
00:B0:07:80:80
|
||||
00:22:41:a4:0c:80:0a:04:00:7f:00:07:02:02:03:02:02
|
||||
00860000457C43804104239E3D05EEB059117D30F86AEB5AE7D12E0EBF758889C79115F2A13DC1BB570A5CAD91A384337C09D1B74BED1C0FF195A7C3EA3A2CEDF86DDEF7B95D1FD1B35D00
|
||||
|
||||
@@ -49,6 +49,8 @@ static u8 chat[0xff];
|
||||
static u8 desc[0xffff];
|
||||
static const char *cdriver = NULL;
|
||||
|
||||
static FILE *input;
|
||||
|
||||
static sc_context_t *ctx = NULL;
|
||||
static sc_card_t *card = NULL;
|
||||
static sc_reader_t *reader;
|
||||
@@ -84,15 +86,15 @@ static const struct option options[] = {
|
||||
{ "new-pin", optional_argument, NULL, OPT_CHANGE_PIN },
|
||||
{ "resume-pin", no_argument, NULL, OPT_RESUME_PIN },
|
||||
{ "unblock-pin", no_argument, NULL, OPT_UNBLOCK_PIN },
|
||||
{ "translate", no_argument, NULL, OPT_TRANSLATE },
|
||||
{ "translate", optional_argument, NULL, OPT_TRANSLATE },
|
||||
{ "verbose", no_argument, NULL, OPT_VERBOSE },
|
||||
{ "info", no_argument, NULL, OPT_INFO },
|
||||
{ NULL, 0, NULL, 0 }
|
||||
};
|
||||
static const char *option_help[] = {
|
||||
"Print help and exit",
|
||||
"Number of reader to use (default: auto-detect)",
|
||||
"Which card driver to use (default: auto-detect)",
|
||||
"Number of reader to use (default: auto-detect)",
|
||||
"Which card driver to use (default: auto-detect)",
|
||||
"Run PACE with (transport) PIN",
|
||||
"Run PACE with PUK",
|
||||
"Run PACE with CAN",
|
||||
@@ -103,7 +105,7 @@ static const char *option_help[] = {
|
||||
"Install a new PIN",
|
||||
"Resume PIN (uses CAN to activate last retry)",
|
||||
"Unblock PIN (uses PUK to activate three more retries)",
|
||||
"Send plaintext APDUs through the PACE SM channel",
|
||||
"APDUs to send through SM channel (default: stdin)",
|
||||
"Use (several times) to be more verbose",
|
||||
"Print version, available readers and drivers.",
|
||||
};
|
||||
@@ -122,7 +124,7 @@ int pace_translate_apdus(struct sm_ctx *sctx, sc_card_t *card)
|
||||
while (1) {
|
||||
printf("Enter unencrypted APDU (empty line to exit)\n");
|
||||
|
||||
linelen = getline(&read, &readlen, stdin);
|
||||
linelen = getline(&read, &readlen, input);
|
||||
if (linelen <= 1) {
|
||||
if (linelen < 0) {
|
||||
r = SC_ERROR_INTERNAL;
|
||||
@@ -183,7 +185,7 @@ main (int argc, char **argv)
|
||||
memset(&pace_output, 0, sizeof pace_output);
|
||||
|
||||
while (1) {
|
||||
i = getopt_long(argc, argv, "hr:i::u::a::z::bC:D:N::RUtvoc:", options, &oindex);
|
||||
i = getopt_long(argc, argv, "hr:i::u::a::z::bC:D:N::RUt::voc:", options, &oindex);
|
||||
if (i == -1)
|
||||
break;
|
||||
switch (i) {
|
||||
@@ -204,7 +206,7 @@ main (int argc, char **argv)
|
||||
verbose++;
|
||||
break;
|
||||
case OPT_INFO:
|
||||
doinfo++;
|
||||
doinfo = 1;
|
||||
break;
|
||||
case OPT_PUK:
|
||||
usepuk = 1;
|
||||
@@ -265,6 +267,11 @@ main (int argc, char **argv)
|
||||
break;
|
||||
case OPT_TRANSLATE:
|
||||
dotranslate = 1;
|
||||
if (optarg) {
|
||||
input = fopen(optarg, "r");
|
||||
if (!input)
|
||||
perror("Opening file with APDUs");
|
||||
}
|
||||
break;
|
||||
case '?':
|
||||
/* fall through */
|
||||
|
||||
Reference in New Issue
Block a user