(2019-02-08 11:17:31 отредактировано lazyBSD)

[rutoken ECP] Debian 9.7 problem

Здравствуйте!

Проблемка возникла на debian в стоке. Помогите, пожалуйста.

root@x230:~$ uname -a
Linux x230 4.9.0-8-amd64 #1 SMP Debian 4.9.130-2 (2018-10-27) x86_64 GNU/Linux
root@x230:~$ cat /etc/debian_version 
9.7
root@x230:~$
root@x230:~# lsusb 
Bus 002 Device 111: ID 17ef:100a Lenovo ThinkPad Mini Dock Plus Series 3
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 005: ID 5986:02d2 Acer, Inc 
Bus 001 Device 008: ID 0a5c:21e6 Broadcom Corp. BCM20702 Bluetooth 4.0 [ThinkPad]
Bus 001 Device 003: ID 147e:2020 Upek TouchChip Fingerprint Coprocessor (WBF advanced mode)
Bus 001 Device 010: ID 0a89:0030 
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 002: ID 1199:68a2 Sierra Wireless, Inc. 
Bus 003 Device 003: ID 0781:5571 SanDisk Corp. Cruzer Fit
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
root@x230:~# 
root@x230:~# apt list | grep -E "pcsc|opensc/|opensc-"

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

libpcsc-perl/stable,now 1.4.14-1+b2 amd64 [установлен, автоматически]
libpcscada0.7.3/stable 0.7.3-1 amd64
libpcscada4-dev/stable 0.7.3-1 amd64
libpcsclite-dev/stable 1.8.20-1 amd64
libpcsclite1/stable,now 1.8.20-1 amd64 [установлен]
libpcsclite1-dbg/stable 1.8.20-1 amd64
opensc/stable,now 0.16.0-3+deb9u1 amd64 [установлен]
opensc-pkcs11/stable,now 0.16.0-3+deb9u1 amd64 [установлен]
pcsc-tools/stable,now 1.4.27-1 amd64 [установлен]
pcscd/stable,now 1.8.20-1 amd64 [установлен]
root@x230:~#
root@x230:~# pkcs15-init -E
Using reader with a card: Aktiv Rutoken ECP 00 00
root@x230:~# pkcs15-init -C --so-pin "87654321" --so-puk ""
Using reader with a card: Aktiv Rutoken ECP 00 00
Failed to create PKCS #15 meta structure: Incorrect parameters in APDU
root@x230:~# 

opensc-debug.log

0x7f7d5c139bc0 10:49:17.966 [opensc-explorer] card-rtecp.c:93:rtecp_init: returning with: 0 (Success)
0x7f7d5c139bc0 10:49:17.966 [opensc-explorer] card.c:307:sc_connect_card: card info name:'Rutoken ECP (DS)', type:0, flags:0x0, max_send/recv_size:255/256
0x7f7d5c139bc0 10:49:17.966 [opensc-explorer] card.c:1330:sc_card_sm_check: called
0x7f7d5c139bc0 10:49:17.966 [opensc-explorer] card.c:1331:sc_card_sm_check: card->sm_ctx.ops.open (nil)
0x7f7d5c139bc0 10:49:17.966 [opensc-explorer] card.c:1336:sc_card_sm_check: returning with: 0 (Success)
0x7f7d5c139bc0 10:49:17.966 [opensc-explorer] card.c:319:sc_connect_card: returning with: 0 (Success)
0x7f7d5c139bc0 10:49:17.966 [opensc-explorer] card.c:394:sc_lock: called
0x7f7d5c139bc0 10:49:17.966 [opensc-explorer] reader-pcsc.c:547:pcsc_lock: called
0x7f7d5c139bc0 10:49:17.966 [opensc-explorer] card.c:698:sc_select_file: called; type=2, path=3f00
0x7f7d5c139bc0 10:49:17.966 [opensc-explorer] apdu.c:550:sc_transmit_apdu: called
0x7f7d5c139bc0 10:49:17.967 [opensc-explorer] card.c:394:sc_lock: called
0x7f7d5c139bc0 10:49:17.967 [opensc-explorer] apdu.c:517:sc_transmit: called
0x7f7d5c139bc0 10:49:17.967 [opensc-explorer] apdu.c:371:sc_single_transmit: called
0x7f7d5c139bc0 10:49:17.967 [opensc-explorer] apdu.c:376:sc_single_transmit: CLA:0, INS:A4, P1:0, P2:0, data(2) 0x7ffc8d0272e0
0x7f7d5c139bc0 10:49:17.967 [opensc-explorer] reader-pcsc.c:269:pcsc_transmit: reader 'Aktiv Rutoken ECP 00 00'
0x7f7d5c139bc0 10:49:17.967 [opensc-explorer] reader-pcsc.c:270:pcsc_transmit:
Outgoing APDU (8 bytes):
00 A4 00 00 02 3F 00 00 .....?..
0x7f7d5c139bc0 10:49:17.967 [opensc-explorer] reader-pcsc.c:199:pcsc_internal_transmit: called
0x7f7d5c139bc0 10:49:17.967 [opensc-explorer] reader-pcsc.c:279:pcsc_transmit:
Incoming APDU (2 bytes):
6A 82 j.
0x7f7d5c139bc0 10:49:17.967 [opensc-explorer] apdu.c:386:sc_single_transmit: returning with: 0 (Success)
0x7f7d5c139bc0 10:49:17.967 [opensc-explorer] apdu.c:539:sc_transmit: returning with: 0 (Success)
0x7f7d5c139bc0 10:49:17.967 [opensc-explorer] card.c:434:sc_unlock: called
0x7f7d5c139bc0 10:49:17.967 [opensc-explorer] iso7816.c:121:iso7816_check_sw: File not found
0x7f7d5c139bc0 10:49:17.967 [opensc-explorer] iso7816.c:550:iso7816_select_file: returning with: -1201 (File not found)
0x7f7d5c139bc0 10:49:17.967 [opensc-explorer] card-rtecp.c:270:rtecp_select_file: returning with: -1201 (File not found)
0x7f7d5c139bc0 10:49:17.967 [opensc-explorer] card.c:720:sc_select_file: 'SELECT' error: -1201 (File not found)
0x7f3163510700 11:15:20.095 [pkcs15-tool] reader-pcsc.c:1296:pcsc_detect_readers: returning with: 0 (Success)
0x7f3163510700 11:15:20.095 [pkcs15-tool] reader-pcsc.c:323:refresh_attributes: returning with: 0 (Success)
0x7f3163510700 11:15:20.095 [pkcs15-tool] reader-pcsc.c:402:pcsc_detect_card_presence: returning with: 1
0x7f3163510700 11:15:20.095 [pkcs15-tool] reader-pcsc.c:323:refresh_attributes: returning with: 0 (Success)
0x7f3163510700 11:15:20.095 [pkcs15-tool] reader-pcsc.c:402:pcsc_detect_card_presence: returning with: 1
0x7f3163510700 11:15:20.095 [pkcs15-tool] card.c:196:sc_connect_card: called
0x7f3163510700 11:15:20.095 [pkcs15-tool] reader-pcsc.c:323:refresh_attributes: returning with: 0 (Success)
0x7f3163510700 11:15:20.096 [pkcs15-tool] card-entersafe.c:134:entersafe_match_card: called
0x7f3163510700 11:15:20.096 [pkcs15-tool] card-rutoken.c:103:rutoken_match_card: called
0x7f3163510700 11:15:20.096 [pkcs15-tool] card-rtecp.c:93:rtecp_init: returning with: 0 (Success)
0x7f3163510700 11:15:20.096 [pkcs15-tool] card-rtecp.c:270:rtecp_select_file: returning with: -1201 (File not found)
0x7f3163510700 11:15:20.096 [pkcs15-tool] card-rtecp.c:270:rtecp_select_file: returning with: -1201 (File not found)
0x7f3163510700 11:15:20.096 [pkcs15-tool] card-rtecp.c:270:rtecp_select_file: returning with: -1201 (File not found)
0x7f3163510700 11:15:20.096 [pkcs15-tool] pkcs15-syn.c:103:sc_pkcs15_bind_synthetic: called
0x7f3163510700 11:15:20.096 [pkcs15-tool] pkcs15-itacns.c:854:sc_pkcs15emu_itacns_init_ex: called
0x7f3163510700 11:15:20.096 [pkcs15-tool] pkcs15-piv.c:1028:sc_pkcs15emu_piv_init_ex: called
0x7f3163510700 11:15:20.096 [pkcs15-tool] pkcs15-piv.c:234:piv_detect_card: called
0x7f3163510700 11:15:20.096 [pkcs15-tool] pkcs15-gemsafeGPK.c:168:gemsafe_detect_card: called
0x7f3163510700 11:15:20.096 [pkcs15-tool] pkcs15-esinit.c:83:sc_pkcs15emu_entersafe_init_ex: called
0x7f3163510700 11:15:20.096 [pkcs15-tool] pkcs15-esinit.c:38:entersafe_detect_card: called
0x7f3163510700 11:15:20.096 [pkcs15-tool] pkcs15-oberthur.c:1028:oberthur_detect_card: called
0x7f3163510700 11:15:20.106 [pkcs15-tool] ctx.c:842:sc_release_context: called

Re: [rutoken ECP] Debian 9.7 problem

Здравствуйте, lazyBSD!

Для более точного ответа, хотелось бы узнать по подробнее. Вы хотите создать структуру именно в pkcs15?

Спасибо.

Re: [rutoken ECP] Debian 9.7 problem

Здравствуйте, Анатолий!

Непринципиально, хочу хоть как-то завести токен.
Руководствовался этим.

Какие ещё у меня есть пути?

Спасибо.

Re: [rutoken ECP] Debian 9.7 problem

Путей много, всё зависит от того с каким сервисом будет взаимодействовать токен.
На нашем портале документации есть раздел "Интеграция устройств Рутокен", ознакомьтесь, возможно найдете, что нужное для себя.

По поводу pkcs15-init. Воспроизвели Ваш случай c Debian 9.7 и OpenSC 0.16.0 из коробки, столкнулись с такой же проблемой.
Рекомендуем Вам обновить OpenSC до версии 0.19.0.
Инструкция по установке из исходников.

Re: [rutoken ECP] Debian 9.7 problem

Огромное спасибо за оперативную помощь!

root@x230:/usr/local/bin# ./pkcs15-init -E
Using reader with a card: Aktiv Rutoken ECP 00 00
root@x230:/usr/local/bin# ./pkcs15-init -C --so-pin "87654321" --so-puk ""
Using reader with a card: Aktiv Rutoken ECP 00 00
root@x230:/usr/local/bin# ./pkcs15-init --version
Using reader with a card: Aktiv Rutoken ECP 00 00
OpenSC-0.19.0-266-gaca9d79f, rev: aca9d79f, commit-time: 2019-02-07 16:56:33 +0100
root@x230:/usr/local/bin#

Re: [rutoken ECP] Debian 9.7 problem

Спасибо Вам за обращение!