carblue / acos5

ACS ACOS5 Smart Card / CryptoMate64 / CryptoMate Nano: Driver and pkcs15init shared libraries for the OpenSC framework.
GNU Lesser General Public License v2.1
13 stars 3 forks source link

ACOS5-64 v1.3 support #4

Closed asemchenko closed 3 years ago

asemchenko commented 4 years ago

I have a problem with connecting ACOS5 smart card which is probably v.3 I have done all as said in README, but it still does not work. Here is log from opensc:

0x7ff78db43740 20:03:55.792 [opensc-tool] ctx.c:792:sc_context_create: ===================================
0x7ff78db43740 20:03:55.792 [opensc-tool] ctx.c:793:sc_context_create: opensc version: 0.17.0
0x7ff78db43740 20:03:55.792 [opensc-tool] reader-pcsc.c:815:pcsc_init: PC/SC options: connect_exclusive=0 disconnect_action=1 transaction_end_action=0 reconnect_action=0 enable_pinpad=1 enable_pace=1
0x7ff78db43740 20:03:55.795 [opensc-tool] ctx.c:463:load_dynamic_driver: successfully loaded card driver 'acos5_external'
0x7ff78db43740 20:03:55.796 [opensc-tool] reader-pcsc.c:1283:pcsc_detect_readers: called
0x7ff78db43740 20:03:55.796 [opensc-tool] reader-pcsc.c:1302:pcsc_detect_readers: Probing PC/SC readers
0x7ff78db43740 20:03:55.796 [opensc-tool] reader-pcsc.c:1330:pcsc_detect_readers: Establish PC/SC context
0x7ff78db43740 20:03:59.229 [opensc-tool] reader-pcsc.c:1242:pcsc_add_reader: Adding new PC/SC reader 'Alcor Micro AU9560 00 00'
0x7ff78db43740 20:03:59.229 [opensc-tool] reader-pcsc.c:319:refresh_attributes: Alcor Micro AU9560 00 00 check
0x7ff78db43740 20:03:59.230 [opensc-tool] reader-pcsc.c:347:refresh_attributes: current  state: 0x00000022
0x7ff78db43740 20:03:59.230 [opensc-tool] reader-pcsc.c:348:refresh_attributes: previous state: 0x00000000
0x7ff78db43740 20:03:59.230 [opensc-tool] reader-pcsc.c:403:refresh_attributes: card present, changed
0x7ff78db43740 20:03:59.301 [opensc-tool] reader-pcsc.c:1408:pcsc_detect_readers: Alcor Micro AU9560 00 00:SCardConnect(SHARED): 0x00000000
0x7ff78db43740 20:03:59.301 [opensc-tool] reader-pcsc.c:1063:detect_reader_features: called
0x7ff78db43740 20:03:59.301 [opensc-tool] reader-pcsc.c:1065:detect_reader_features: Requesting reader features ... 
0x7ff78db43740 20:03:59.301 [opensc-tool] reader-pcsc.c:1086:detect_reader_features: Reader feature 12 found
0x7ff78db43740 20:03:59.302 [opensc-tool] reader-pcsc.c:1004:part10_detect_max_data: get dwMaxAPDUDataSize property returned 65536
0x7ff78db43740 20:03:59.302 [opensc-tool] reader-pcsc.c:1192:detect_reader_features: Reader supports transceiving 65536 bytes of data
0x7ff78db43740 20:03:59.302 [opensc-tool] reader-pcsc.c:1197:detect_reader_features: Sending is limited to 255 bytes of data in configuration file
0x7ff78db43740 20:03:59.302 [opensc-tool] reader-pcsc.c:1043:part10_get_vendor_product: id_vendor=058f id_product=9540
0x7ff78db43740 20:03:59.305 [opensc-tool] reader-pcsc.c:1423:pcsc_detect_readers: returning with: 0 (Success)
0x7ff78db43740 20:03:59.305 [opensc-tool] sc.c:275:sc_detect_card_presence: called
0x7ff78db43740 20:03:59.305 [opensc-tool] reader-pcsc.c:411:pcsc_detect_card_presence: called
0x7ff78db43740 20:03:59.305 [opensc-tool] reader-pcsc.c:319:refresh_attributes: Alcor Micro AU9560 00 00 check
0x7ff78db43740 20:03:59.306 [opensc-tool] reader-pcsc.c:339:refresh_attributes: returning with: 0 (Success)
0x7ff78db43740 20:03:59.306 [opensc-tool] reader-pcsc.c:416:pcsc_detect_card_presence: returning with: 1
0x7ff78db43740 20:03:59.306 [opensc-tool] sc.c:280:sc_detect_card_presence: returning with: 1
0x7ff78db43740 20:03:59.307 [opensc-tool] sc.c:275:sc_detect_card_presence: called
0x7ff78db43740 20:03:59.307 [opensc-tool] reader-pcsc.c:411:pcsc_detect_card_presence: called
0x7ff78db43740 20:03:59.307 [opensc-tool] reader-pcsc.c:319:refresh_attributes: Alcor Micro AU9560 00 00 check
0x7ff78db43740 20:03:59.307 [opensc-tool] reader-pcsc.c:339:refresh_attributes: returning with: 0 (Success)
0x7ff78db43740 20:03:59.307 [opensc-tool] reader-pcsc.c:416:pcsc_detect_card_presence: returning with: 1
0x7ff78db43740 20:03:59.308 [opensc-tool] sc.c:280:sc_detect_card_presence: returning with: 1
0x7ff78db43740 20:03:59.308 [opensc-tool] card.c:200:sc_connect_card: called
0x7ff78db43740 20:03:59.308 [opensc-tool] reader-pcsc.c:533:pcsc_connect: called
0x7ff78db43740 20:03:59.308 [opensc-tool] reader-pcsc.c:319:refresh_attributes: Alcor Micro AU9560 00 00 check
0x7ff78db43740 20:03:59.309 [opensc-tool] reader-pcsc.c:339:refresh_attributes: returning with: 0 (Success)
0x7ff78db43740 20:03:59.309 [opensc-tool] reader-pcsc.c:565:pcsc_connect: Initial protocol: T=1
0x7ff78db43740 20:03:59.309 [opensc-tool] card.c:1057:match_atr_table: ATR     : 3b:9e:96:80:01:41:05:41:00:00:00:00:00:00:00:00:00:90:00:1c
0x7ff78db43740 20:03:59.309 [opensc-tool] card.c:1068:match_atr_table: ATR try : 3b:6e:00:ff:45:73:74:45:49:44:20:76:65:72:20:31:2e:30
0x7ff78db43740 20:03:59.309 [opensc-tool] card.c:1071:match_atr_table: ignored - wrong length
0x7ff78db43740 20:03:59.309 [opensc-tool] card.c:1068:match_atr_table: ATR try : 3b:fe:94:00:ff:80:b1:fa:45:1f:03:45:73:74:45:49:44:20:76:65:72:20:31:2e:30:43
0x7ff78db43740 20:03:59.309 [opensc-tool] card.c:1071:match_atr_table: ignored - wrong length
0x7ff78db43740 20:03:59.309 [opensc-tool] card.c:1068:match_atr_table: ATR try : 3b:5e:11:ff:45:73:74:45:49:44:20:76:65:72:20:31:2e:30
0x7ff78db43740 20:03:59.309 [opensc-tool] card.c:1071:match_atr_table: ignored - wrong length
0x7ff78db43740 20:03:59.309 [opensc-tool] card.c:1068:match_atr_table: ATR try : 3b:de:18:ff:c0:80:b1:fe:45:1f:03:45:73:74:45:49:44:20:76:65:72:20:31:2e:30:2b
0x7ff78db43740 20:03:59.309 [opensc-tool] card.c:1071:match_atr_table: ignored - wrong length
0x7ff78db43740 20:03:59.309 [opensc-tool] card.c:1068:match_atr_table: ATR try : 3b:6e:00:00:45:73:74:45:49:44:20:76:65:72:20:31:2e:30
0x7ff78db43740 20:03:59.309 [opensc-tool] card.c:1071:match_atr_table: ignored - wrong length
0x7ff78db43740 20:03:59.309 [opensc-tool] card.c:1068:match_atr_table: ATR try : 3b:ff:94:00:ff:80:b1:fe:45:1f:03:00:68:d2:76:00:00:28:ff:05:1e:31:80:00:90:00:23
0x7ff78db43740 20:03:59.309 [opensc-tool] card.c:1071:match_atr_table: ignored - wrong length
0x7ff78db43740 20:03:59.309 [opensc-tool] card.c:1068:match_atr_table: ATR try : 3b:ff:11:00:ff:80:b1:fe:45:1f:03:00:68:d2:76:00:00:28:ff:05:1e:31:80:00:90:00:a6
0x7ff78db43740 20:03:59.309 [opensc-tool] card.c:1071:match_atr_table: ignored - wrong length
0x7ff78db43740 20:03:59.309 [opensc-tool] card.c:225:sc_connect_card: matching configured ATRs
0x7ff78db43740 20:03:59.309 [opensc-tool] card.c:268:sc_connect_card: matching built-in ATRs
0x7ff78db43740 20:03:59.310 [opensc-tool] card.c:273:sc_connect_card: trying driver 'acos5_external'
0x7ff78db43740 20:03:59.310 [opensc-tool] acos5:413:acos5_match_card: called. Try to match card with ATR 3B9E9680014105410000000000000000 0090001C
0x7ff78db43740 20:03:59.310 [opensc-tool] card.c:1057:match_atr_table: ATR     : 3b:9e:96:80:01:41:05:41:00:00:00:00:00:00:00:00:00:90:00:1c
0x7ff78db43740 20:03:59.310 [opensc-tool] card.c:1068:match_atr_table: ATR try : 3b:be:96:00:00:41:05:20:00:00:00:00:00:00:00:00:00:90:00
0x7ff78db43740 20:03:59.310 [opensc-tool] card.c:1071:match_atr_table: ignored - wrong length
0x7ff78db43740 20:03:59.310 [opensc-tool] card.c:1068:match_atr_table: ATR try : 3b:be:96:00:00:41:05:30:00:00:00:00:00:00:00:00:00:90:00
0x7ff78db43740 20:03:59.310 [opensc-tool] card.c:1071:match_atr_table: ignored - wrong length
0x7ff78db43740 20:03:59.310 [opensc-tool] card.c:1068:match_atr_table: ATR try : 3b:9e:96:80:01:41:05:40:00:00:00:00:00:00:00:00:00:90:00
0x7ff78db43740 20:03:59.310 [opensc-tool] card.c:1071:match_atr_table: ignored - wrong length
0x7ff78db43740 20:03:59.310 [opensc-tool] acos5:432:acos5_match_card: Card doesn't match: Differing ATR
0x7ff78db43740 20:03:59.310 [opensc-tool] card.c:273:sc_connect_card: trying driver 'default'
0x7ff78db43740 20:03:59.310 [opensc-tool] card.c:287:sc_connect_card: matched: Default driver for unknown cards
0x7ff78db43740 20:03:59.310 [opensc-tool] card-default.c:47:default_init: called
0x7ff78db43740 20:03:59.310 [opensc-tool] card-default.c:52:default_init: returning with: 0 (Success)
0x7ff78db43740 20:03:59.310 [opensc-tool] card.c:317:sc_connect_card: card info name:'Unsupported card', type:0, flags:0x0, max_send/recv_size:255/256
0x7ff78db43740 20:03:59.310 [opensc-tool] card.c:1414:sc_card_sm_check: called
0x7ff78db43740 20:03:59.310 [opensc-tool] card.c:1415:sc_card_sm_check: card->sm_ctx.ops.open (nil)
0x7ff78db43740 20:03:59.310 [opensc-tool] card.c:1057:match_atr_table: ATR     : 3b:9e:96:80:01:41:05:41:00:00:00:00:00:00:00:00:00:90:00:1c
0x7ff78db43740 20:03:59.310 [opensc-tool] card.c:1068:match_atr_table: ATR try : 3b:6e:00:ff:45:73:74:45:49:44:20:76:65:72:20:31:2e:30
0x7ff78db43740 20:03:59.310 [opensc-tool] card.c:1071:match_atr_table: ignored - wrong length
0x7ff78db43740 20:03:59.310 [opensc-tool] card.c:1068:match_atr_table: ATR try : 3b:fe:94:00:ff:80:b1:fa:45:1f:03:45:73:74:45:49:44:20:76:65:72:20:31:2e:30:43
0x7ff78db43740 20:03:59.310 [opensc-tool] card.c:1071:match_atr_table: ignored - wrong length
0x7ff78db43740 20:03:59.310 [opensc-tool] card.c:1068:match_atr_table: ATR try : 3b:5e:11:ff:45:73:74:45:49:44:20:76:65:72:20:31:2e:30
0x7ff78db43740 20:03:59.310 [opensc-tool] card.c:1071:match_atr_table: ignored - wrong length
0x7ff78db43740 20:03:59.310 [opensc-tool] card.c:1068:match_atr_table: ATR try : 3b:de:18:ff:c0:80:b1:fe:45:1f:03:45:73:74:45:49:44:20:76:65:72:20:31:2e:30:2b
0x7ff78db43740 20:03:59.310 [opensc-tool] card.c:1071:match_atr_table: ignored - wrong length
0x7ff78db43740 20:03:59.310 [opensc-tool] card.c:1068:match_atr_table: ATR try : 3b:6e:00:00:45:73:74:45:49:44:20:76:65:72:20:31:2e:30
0x7ff78db43740 20:03:59.310 [opensc-tool] card.c:1071:match_atr_table: ignored - wrong length
0x7ff78db43740 20:03:59.310 [opensc-tool] card.c:1068:match_atr_table: ATR try : 3b:ff:94:00:ff:80:b1:fe:45:1f:03:00:68:d2:76:00:00:28:ff:05:1e:31:80:00:90:00:23
0x7ff78db43740 20:03:59.310 [opensc-tool] card.c:1071:match_atr_table: ignored - wrong length
0x7ff78db43740 20:03:59.310 [opensc-tool] card.c:1068:match_atr_table: ATR try : 3b:ff:11:00:ff:80:b1:fe:45:1f:03:00:68:d2:76:00:00:28:ff:05:1e:31:80:00:90:00:a6
0x7ff78db43740 20:03:59.310 [opensc-tool] card.c:1071:match_atr_table: ignored - wrong length
0x7ff78db43740 20:03:59.310 [opensc-tool] card.c:1420:sc_card_sm_check: returning with: 0 (Success)
0x7ff78db43740 20:03:59.310 [opensc-tool] card.c:329:sc_connect_card: returning with: 0 (Success)
0x7ff78db43740 20:03:59.310 [opensc-tool] card.c:407:sc_lock: called
0x7ff78db43740 20:03:59.311 [opensc-tool] reader-pcsc.c:612:pcsc_lock: called
0x7ff78db43740 20:03:59.311 [opensc-tool] card.c:449:sc_lock: returning with: 0 (Success)
0x7ff78db43740 20:03:59.311 [opensc-tool] card.c:920:sc_card_ctl: called
0x7ff78db43740 20:03:59.311 [opensc-tool] card.c:927:sc_card_ctl: card_ctl(5) not supported
0x7ff78db43740 20:03:59.311 [opensc-tool] card.c:459:sc_unlock: called
0x7ff78db43740 20:03:59.311 [opensc-tool] reader-pcsc.c:662:pcsc_unlock: called
0x7ff78db43740 20:03:59.320 [opensc-tool] card.c:346:sc_disconnect_card: called
0x7ff78db43740 20:03:59.392 [opensc-tool] reader-pcsc.c:597:pcsc_disconnect: Alcor Micro AU9560 00 00:SCardDisconnect returned: 0x00000000
0x7ff78db43740 20:03:59.392 [opensc-tool] card.c:368:sc_disconnect_card: returning with: 0 (Success)
0x7ff78db43740 20:03:59.392 [opensc-tool] ctx.c:870:sc_release_context: called
0x7ff78db43740 20:03:59.392 [opensc-tool] reader-pcsc.c:896:pcsc_finish: called

I guess there is a problem here:

0x7ff78db43740 20:03:59.310 [opensc-tool] card.c:273:sc_connect_card: trying driver 'acos5_external'
0x7ff78db43740 20:03:59.310 [opensc-tool] acos5:413:acos5_match_card: called. Try to match card with ATR 3B9E9680014105410000000000000000 0090001C
0x7ff78db43740 20:03:59.310 [opensc-tool] card.c:1057:match_atr_table: ATR     : 3b:9e:96:80:01:41:05:41:00:00:00:00:00:00:00:00:00:90:00:1c
0x7ff78db43740 20:03:59.310 [opensc-tool] card.c:1068:match_atr_table: ATR try : 3b:be:96:00:00:41:05:20:00:00:00:00:00:00:00:00:00:90:00
0x7ff78db43740 20:03:59.310 [opensc-tool] card.c:1071:match_atr_table: ignored - wrong length
0x7ff78db43740 20:03:59.310 [opensc-tool] card.c:1068:match_atr_table: ATR try : 3b:be:96:00:00:41:05:30:00:00:00:00:00:00:00:00:00:90:00
0x7ff78db43740 20:03:59.310 [opensc-tool] card.c:1071:match_atr_table: ignored - wrong length
0x7ff78db43740 20:03:59.310 [opensc-tool] card.c:1068:match_atr_table: ATR try : 3b:9e:96:80:01:41:05:40:00:00:00:00:00:00:00:00:00:90:00
0x7ff78db43740 20:03:59.310 [opensc-tool] card.c:1071:match_atr_table: ignored - wrong length
0x7ff78db43740 20:03:59.310 [opensc-tool] acos5:432:acos5_match_card: Card doesn't match: Differing ATR

Is this a problem with smard card version? Can you help me to fix this problem, please?

carblue commented 4 years ago

Hello Andrii, the short answer: Your card (version) isn't yet supported by my driver. The longer answer: Your card's ATR : 3b:9e:96:80:01:41:05:41:00:00:00:00:00:00:00:00:00:90:00:1c get's compared against 3 ACOS5 ATRs I know about, each for a different ACOS5 hardware version, and the closest to a match is the last one for V4.00 EVO cards: 3b:9e:96:80:01:41:05:40:00:00:00:00:00:00:00:00:00:90:00. Your card seems to be a V4.10 EVO card with a strange excessive byte in the end : 1c. Even if the ATRs would have matched, I should say it's unsupported, as I just started to cover that card (from a V4.00 EVO reference manual) in the source code and I don't have that card in order to test. I'm interested in buying an USB token version of that card only and got no reply from ACS if/when that will be available. Thus I will remove any mention of EVO support from the README and matching source code.

asemchenko commented 4 years ago

Ok, I got you. Thank you for answering!