{"action":"created","issue":{"url":"https://api.github.com/repos/OpenSC/OpenSC/issues/1676","repository_url":"https://api.github.com/repos/OpenSC/OpenSC","labels_url":"https://api.github.com/repos/OpenSC/OpenSC/issues/1676/labels{/name}","comments_url":"https://api.github.com/repos/OpenSC/OpenSC/issues/1676/comments","events_url":"https://api.github.com/repos/OpenSC/OpenSC/issues/1676/events","html_url":"https://github.com/OpenSC/OpenSC/issues/1676","id":444389334,"node_id":"MDU6SXNzdWU0NDQzODkzMzQ=","number":1676,"title":"help w/ SmartCafe Expert 7 card","user":{"login":"ebbimish","id":50662398,"node_id":"MDQ6VXNlcjUwNjYyMzk4","avatar_url":"https://avatars0.githubusercontent.com/u/50662398?v=4","gravatar_id":"","url":"https://api.github.com/users/ebbimish","html_url":"https://github.com/ebbimish","followers_url":"https://api.github.com/users/ebbimish/followers","following_url":"https://api.github.com/users/ebbimish/following{/other_user}","gists_url":"https://api.github.com/users/ebbimish/gists{/gist_id}","starred_url":"https://api.github.com/users/ebbimish/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ebbimish/subscriptions","organizations_url":"https://api.github.com/users/ebbimish/orgs","repos_url":"https://api.github.com/users/ebbimish/repos","events_url":"https://api.github.com/users/ebbimish/events{/privacy}","received_events_url":"https://api.github.com/users/ebbimish/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2019-05-15T11:38:24Z","updated_at":"2019-05-15T12:04:22Z","closed_at":null,"author_association":"NONE","body":"### Problem Description\r\n\r\nI am new to the world of smart cards.  I apologize in advance if I'm mistaken in my terminology or the location I'm posting this question in.\r\n\r\nI have a Xilinx ZCU102 dev board running petalinux w/ OpenSC.  I've got a USB smartcard reader attached to the board with a G&D SmartCafe 7 card.  The G&D is running an applet that simply outputs a 16-byte random number on command.  This behavior has been confirmed on a Maxim dev board (i.e. we know for a fact the applet works and outputs the random number).  The difference is that the Maxim dev board isn't using OpenSC with a USB smartcard reader, but rather some higher level drivers meant for interfacing with smartcards along w/ a standardized smartcard interface (i.e. no USB).  However, I have the APDU commands it outputs to the smartcard.\r\n\r\nThe card responds to an ATR request using the default driver, so I edited opensc.conf and added the ATR as a new card and forced it to use the default driver and forced the protocol to T0 (which is correct for this particular card).  I next send the following APDU to choose the applet:\r\n# opensc-tool -c default --send-apdu \"00 a4 04 00 0e d1 76 00 00 04 15 ff 80 00 00 07 00 04 04 00\"\r\nUsing reader with a card: CCID Compatible\r\nSending: 00 A4 04 00 0E D1 76 00 00 04 15 FF 80 00 00 07 00 04 04 00\r\nReceived (SW1=0x90, SW2=0x00)\r\n\r\nAs you can see, that responds correctly.\r\n\r\nFinally, I send a discrete command to give me the random number:\r\n# opensc-tool -c default --send-apdu \"80 84 00 00 10\"\r\nUsing reader with a card: CCID Compatible\r\nSending: 80 84 00 00 10\r\nReceived (SW1=0x6D, SW2=0x00)\r\n\r\nI've spent a couple days now debugging this and digging in and have come up empty handed...if there was something wrong w/ my message format or the USB interface, then I don't think the ATR or the first APDU command above would work.  I know this is a valid APDU...but the response is always 6D/00.\r\n\r\nI again apologize if I have pasted this in the wrong place.  If that's the case, I would greatly appreciate direction as to where I can get help with this issue.  Thank you very much...\r\n\r\n### Logs\r\n\r\n../../../opensc-0.16.0/src/libopensc/sc.c:259:sc_detect_card_presence: called\r\n../../../opensc-0.16.0/src/libopensc/reader-openct.c:182:openct_reader_detect_card_presence: called\r\n../../../opensc-0.16.0/src/libopensc/sc.c:264:sc_detect_card_presence: returning with: 1\r\nUsing reader with a card: CCID Compatible\r\n../../../opensc-0.16.0/src/libopensc/sc.c:259:sc_detect_card_presence: called\r\n../../../opensc-0.16.0/src/libopensc/reader-openct.c:182:openct_reader_detect_card_presence: called\r\n../../../opensc-0.16.0/src/libopensc/sc.c:264:sc_detect_card_presence: returning with: 1\r\nConnecting to card in reader CCID Compatible...\r\n../../../opensc-0.16.0/src/libopensc/card.c:196:sc_connect_card: called\r\n../../../opensc-0.16.0/src/libopensc/reader-openct.c:208:openct_reader_connect: called\r\n../../../opensc-0.16.0/src/libopensc/card-default.c:47:default_init: called\r\n../../../opensc-0.16.0/src/libopensc/card-default.c:52:default_init: returning with: 0 (Success)\r\n../../../opensc-0.16.0/src/libopensc/card.c:307:sc_connect_card: card info name:'Unsupported card', type:-1, flags:0x0, max_send/recv_size:255/256\r\n../../../opensc-0.16.0/src/libopensc/card.c:1330:sc_card_sm_check: called\r\n../../../opensc-0.16.0/src/libopensc/card.c:1331:sc_card_sm_check: card->sm_ctx.ops.open (nil)\r\n../../../opensc-0.16.0/src/libopensc/card.c:978:match_atr_table: ATR     : 3b:f9:96:00:00:80:31:fe:45:53:43:45:37:20:00:00:20:20:27\r\n../../../opensc-0.16.0/src/libopensc/card.c:989:match_atr_table: ATR try : 3b:f9:96:00:00:80:31:fe:45:53:43:45:37:20:00:00:20:20:27\r\n../../../opensc-0.16.0/src/libopensc/card.c:1339:sc_card_sm_check: returning with: 0 (Success)\r\n../../../opensc-0.16.0/src/libopensc/card.c:319:sc_connect_card: returning with: 0 (Success)\r\nUsing card driver Default driver for unknown cards.\r\n../../../opensc-0.16.0/src/libopensc/card.c:394:sc_lock: called\r\n../../../opensc-0.16.0/src/libopensc/reader-openct.c:402:openct_reader_lock: called\r\n../../../opensc-0.16.0/src/libopensc/apdu.c:749:sc_bytes2apdu: Case 2 short APDU, 5 bytes:      ins=84 p1=00 p2=00 lc=0000 le=0010\r\nSending: 80 84 00 00 10\r\n../../../opensc-0.16.0/src/libopensc/apdu.c:550:sc_transmit_apdu: called\r\n../../../opensc-0.16.0/src/libopensc/card.c:394:sc_lock: called\r\n../../../opensc-0.16.0/src/libopensc/apdu.c:517:sc_transmit: called\r\n../../../opensc-0.16.0/src/libopensc/apdu.c:371:sc_single_transmit: called\r\n../../../opensc-0.16.0/src/libopensc/apdu.c:376:sc_single_transmit: CLA:80, INS:84, P1:0, P2:0, data(0) (nil)\r\n../../../opensc-0.16.0/src/libopensc/reader-openct.c:311:openct_reader_transmit:\r\nOutgoing APDU (5 bytes):\r\n80 84 00 00 10 .....\r\n../../../opensc-0.16.0/src/libopensc/reader-openct.c:319:openct_reader_transmit:\r\nIncoming APDU (2 bytes):\r\n6D 00 m.\r\n../../../opensc-0.16.0/src/libopensc/apdu.c:386:sc_single_transmit: returning with: 0 (Success)\r\n../../../opensc-0.16.0/src/libopensc/apdu.c:539:sc_transmit: returning with: 0 (Success)\r\n../../../opensc-0.16.0/src/libopensc/card.c:434:sc_unlock: called\r\nReceived (SW1=0x6D, SW2=0x00)\r\n../../../opensc-0.16.0/src/libopensc/card.c:434:sc_unlock: called\r\n../../../opensc-0.16.0/src/libopensc/reader-openct.c:431:openct_reader_unlock: called\r\n../../../opensc-0.16.0/src/libopensc/card.c:336:sc_disconnect_card: called\r\n../../../opensc-0.16.0/src/libopensc/reader-openct.c:257:openct_reader_disconnect: called\r\n../../../opensc-0.16.0/src/libopensc/card.c:357:sc_disconnect_card: returning with: 0 (Success)\r\n../../../opensc-0.16.0/src/libopensc/ctx.c:842:sc_release_context: called\r\n../../../opensc-0.16.0/src/libopensc/reader-openct.c:162:openct_reader_release: called\r\n../../../opensc-0.16.0/src/libopensc/reader-openct.c:162:openct_reader_release: called\r\n../../../opensc-0.16.0/src/libopensc/reader-openct.c:149:openct_reader_finish: called\r\n"},"comment":{"url":"https://api.github.com/repos/OpenSC/OpenSC/issues/comments/492626075","html_url":"https://github.com/OpenSC/OpenSC/issues/1676#issuecomment-492626075","issue_url":"https://api.github.com/repos/OpenSC/OpenSC/issues/1676","id":492626075,"node_id":"MDEyOklzc3VlQ29tbWVudDQ5MjYyNjA3NQ==","user":{"login":"ebbimish","id":50662398,"node_id":"MDQ6VXNlcjUwNjYyMzk4","avatar_url":"https://avatars0.githubusercontent.com/u/50662398?v=4","gravatar_id":"","url":"https://api.github.com/users/ebbimish","html_url":"https://github.com/ebbimish","followers_url":"https://api.github.com/users/ebbimish/followers","following_url":"https://api.github.com/users/ebbimish/following{/other_user}","gists_url":"https://api.github.com/users/ebbimish/gists{/gist_id}","starred_url":"https://api.github.com/users/ebbimish/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ebbimish/subscriptions","organizations_url":"https://api.github.com/users/ebbimish/orgs","repos_url":"https://api.github.com/users/ebbimish/repos","events_url":"https://api.github.com/users/ebbimish/events{/privacy}","received_events_url":"https://api.github.com/users/ebbimish/received_events","type":"User","site_admin":false},"created_at":"2019-05-15T12:04:22Z","updated_at":"2019-05-15T12:04:22Z","author_association":"NONE","body":"HA!!!  That worked!!!\r\n\r\nThank you SO MUCH!!!\r\n\r\nHow did you know the card was being reset during each invocation?  Is that standard for smartcards or were you able to tell from the log I pasted?  Again, thank you so much."}}
{"actor":{"display_login":"ebbimish"}}