From 8743b5030b3154df694fd25cfd38db1517109701 Mon Sep 17 00:00:00 2001 From: frankmorgner Date: Thu, 28 Oct 2010 09:10:38 +0000 Subject: [PATCH] - fixed: pace-tool dumped wrong apdu buffer - updated documentation on opensc git-svn-id: https://vsmartcard.svn.sourceforge.net/svnroot/vsmartcard@346 96b47cad-a561-4643-ad3b-153ac7d7599c --- ccid/README.dox | 16 ++++++++++++---- ccid/apdus | 1 + ccid/src/pace-tool.c | 4 ++-- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/ccid/README.dox b/ccid/README.dox index b381a38..6846fd7 100644 --- a/ccid/README.dox +++ b/ccid/README.dox @@ -38,10 +38,18 @@ If you only use pace-tool for testing your card, you don't need gadgetfs. @subsection o HINTS ON OPENSC -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). 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 +OpenSC older than r4244 will yield something like this error: + +[default] apdu.c:341:sc_check_apdu: Invalid Case 4 short APDU: +cse=04 cla=10 ins=86 p1=00 p2=00 lc=2 le=0 +resp=0x10353c0 resplen=256 data=0x1034a30 datalen=2 +[default] pace.c:1110:EstablishPACEChannel: Could not get encrypted nonce from card (General Authenticate step 1 failed). + +It requires the following patch: +http://www.opensc-project.org/opensc/raw-attachment/ticket/209/le0.patch + +The following patch makes the hex dumped output more readable: +http://www.opensc-project.org/opensc/raw-attachment/ticket/263/hex_dump_align.patch @section u USAGE diff --git a/ccid/apdus b/ccid/apdus index cce831e..922c3cd 100644 --- a/ccid/apdus +++ b/ccid/apdus @@ -25,4 +25,5 @@ 00:B0:07:80:80 00:22:41:a4:0c:80:0a:04:00:7f:00:07:02:02:03:02:02 00860000457C43804104239E3D05EEB059117D30F86AEB5AE7D12E0EBF758889C79115F2A13DC1BB570A5CAD91A384337C09D1B74BED1C0FF195A7C3EA3A2CEDF86DDEF7B95D1FD1B35D00 +0020001006010203040506 diff --git a/ccid/src/pace-tool.c b/ccid/src/pace-tool.c index ed2b8ee..3e19dea 100644 --- a/ccid/src/pace-tool.c +++ b/ccid/src/pace-tool.c @@ -136,14 +136,14 @@ int pace_translate_apdus(struct sm_ctx *sctx, sc_card_t *card, FILE *input) break; } read[linelen - 1] = 0; - if (input != stdin) - bin_print(stdout, "Unencrypted C-APDU", read, linelen); apdulen = sizeof buf; if (sc_hex_to_bin(read, buf, &apdulen) < 0) { sc_error(card->ctx, "Could not format binary string"); continue; } + if (input != stdin) + bin_print(stdout, "Unencrypted C-APDU", buf, apdulen); r = build_apdu(card->ctx, buf, apdulen, &apdu); if (r < 0) {