linux & openct токен виден но не форматируется

Есть новый rutoken, который отлично виден через openct:

opensc-tool --list-readers
# Detected readers (pcsc)
Nr.  Card  Features  Name
0    Yes             Aktiv Rutoken S 00 00

но при попытке отформатировать его или прочитать что-либо, даёт ошибку:

opensc-tool --reader 0 --name
Matched ATR in reader: Aktiv Rutoken S 00 00
Failed to connect to card: Generic reader error

pkcs15-init --erase-card
Using reader with a card: Aktiv Rutoken S 00 00
Failed to connect to card: Generic reader error

версии приложений:

pcscd           1.7.4
openct          0.6.20
opensc          0.12.2

Что я делаю не так?

Re: linux & openct токен виден но не форматируется

Вы очистили Рутокен, но не создали на нем нужной структуры pkcs#15.
Вполне естественно, что утилиты не находят нужных им объектов.

Вот как выглядит полная переинициализация Рутокена S:

$ pkcs15-init --erase-card
$ pkcs15-init --create-pkcs15 --so-pin "87654321" --so-puk ""
$ pkcs15-init --store-pin --label "User PIN" --auth-id 02 --pin "12345678" --puk ""

Подробности здесь:

http://www.opensc-project.org/opensc/wiki/AktivRutokenS

(2011-10-20 12:22:50 отредактировано chollya)

Re: linux & openct токен виден но не форматируется

Кирилл Мещеряков пишет:

Вы очистили Рутокен, но не создали на нем нужной структуры pkcs#15.

В том то и дело, что ни очистить, ни создать структуру pkcs#15 мне не даёт:


pkcs15-init --erase-card Using reader with a card: Aktiv Rutoken S 00 00
Failed to connect to card: Generic reader error

pkcs15-init --create-pkcs15 --so-pin "034009100280477" --so-puk ""
Using reader with a card: Aktiv Rutoken S 00 00
User PIN required.
Please enter User PIN:
Failed to create PKCS #15 meta structure: File already exists

pkcs15-init --store-pin --label "User PIN" --auth-id 02 --pin "12345678" --puk ""
Using reader with a card: Aktiv Rutoken S 00 00
Failed to connect to card: Generic reader error

Re: linux & openct токен виден но не форматируется

Поставьте, пожалуйста, в файле /etc/opensc.conf значение debug = 6 и запустите

$pkcs15-init --erase-card

Посмотрим, что он скажет.

(2012-02-08 11:18:17 отредактировано biiont)

Re: linux & openct токен виден но не форматируется

Кирилл Мещеряков пишет:

Поставьте, пожалуйста, в файле /etc/opensc.conf значение debug = 6 и запустите

$pkcs15-init --erase-card

Посмотрим, что он скажет.

Аналогичная проблема - Rutoken S (0a89:0020) 32K200Z.

Для работоспособности токена форматировал под windows утилитой rtCert, все ок. Но под линукс получается ошибка.

pkcs15-init --erase-card

biiont@bitheap ~ % pkcs15-init --erase-card
0xb724e6c0 14:11:07.546 [pkcs15-init] ctx.c:659:sc_context_create: ===================================
0xb724e6c0 14:11:07.546 [pkcs15-init] ctx.c:660:sc_context_create: opensc version: 0.12.2
0xb724e6c0 14:11:07.546 [pkcs15-init] reader-pcsc.c:657:pcsc_init: PC/SC options: connect_exclusive=0 disconnect_action=1 transaction_end_action=0 reconnect_action=0 enable_pinpad=1
0xb724e6c0 14:11:07.546 [pkcs15-init] reader-pcsc.c:870:pcsc_detect_readers: called
0xb724e6c0 14:11:07.546 [pkcs15-init] reader-pcsc.c:878:pcsc_detect_readers: Probing pcsc readers
0xb724e6c0 14:11:07.546 [pkcs15-init] reader-pcsc.c:900:pcsc_detect_readers: Establish pcsc context
0xb724e6c0 14:11:07.546 [pkcs15-init] reader-pcsc.c:948:pcsc_detect_readers: Found new pcsc reader 'Aktiv Rutoken S 00 00'
0xb724e6c0 14:11:07.547 [pkcs15-init] reader-pcsc.c:277:refresh_attributes: Aktiv Rutoken S 00 00 check
0xb724e6c0 14:11:07.947 [pkcs15-init] reader-pcsc.c:301:refresh_attributes: current  state: 0x00000022
0xb724e6c0 14:11:07.947 [pkcs15-init] reader-pcsc.c:302:refresh_attributes: previous state: 0x00000000
0xb724e6c0 14:11:07.947 [pkcs15-init] reader-pcsc.c:356:refresh_attributes: card present, changed
0xb724e6c0 14:11:07.947 [pkcs15-init] reader-pcsc.c:979:pcsc_detect_readers: Requesting reader features ... 
0xb724e6c0 14:11:07.947 [pkcs15-init] reader-pcsc.c:993:pcsc_detect_readers: Aktiv Rutoken S 00 00:SCardConnect(SHARED): 0x8010000f
0xb724e6c0 14:11:07.947 [pkcs15-init] reader-pcsc.c:1023:pcsc_detect_readers: returning with: 0 (Success)
0xb724e6c0 14:11:07.947 [pkcs15-init] sc.c:195:sc_detect_card_presence: called
0xb724e6c0 14:11:07.947 [pkcs15-init] reader-pcsc.c:364:pcsc_detect_card_presence: called
0xb724e6c0 14:11:07.947 [pkcs15-init] reader-pcsc.c:277:refresh_attributes: Aktiv Rutoken S 00 00 check
0xb724e6c0 14:11:08.347 [pkcs15-init] reader-pcsc.c:293:refresh_attributes: returning with: 0 (Success)
0xb724e6c0 14:11:08.347 [pkcs15-init] reader-pcsc.c:369:pcsc_detect_card_presence: returning with: 1
0xb724e6c0 14:11:08.347 [pkcs15-init] sc.c:200:sc_detect_card_presence: returning with: 1
Using reader with a card: Aktiv Rutoken S 00 00
0xb724e6c0 14:11:08.347 [pkcs15-init] sc.c:195:sc_detect_card_presence: called
0xb724e6c0 14:11:08.347 [pkcs15-init] reader-pcsc.c:364:pcsc_detect_card_presence: called
0xb724e6c0 14:11:08.347 [pkcs15-init] reader-pcsc.c:277:refresh_attributes: Aktiv Rutoken S 00 00 check
0xb724e6c0 14:11:08.748 [pkcs15-init] reader-pcsc.c:293:refresh_attributes: returning with: 0 (Success)
0xb724e6c0 14:11:08.748 [pkcs15-init] reader-pcsc.c:369:pcsc_detect_card_presence: returning with: 1
0xb724e6c0 14:11:08.748 [pkcs15-init] sc.c:200:sc_detect_card_presence: returning with: 1
0xb724e6c0 14:11:08.748 [pkcs15-init] card.c:115:sc_connect_card: called
0xb724e6c0 14:11:08.748 [pkcs15-init] reader-pcsc.c:444:pcsc_connect: called
0xb724e6c0 14:11:08.748 [pkcs15-init] reader-pcsc.c:277:refresh_attributes: Aktiv Rutoken S 00 00 check
0xb724e6c0 14:11:09.148 [pkcs15-init] reader-pcsc.c:293:refresh_attributes: returning with: 0 (Success)
0xb724e6c0 14:11:09.148 [pkcs15-init] reader-pcsc.c:466:pcsc_connect: Aktiv Rutoken S 00 00:SCardConnect failed: 0x8010000f
0xb724e6c0 14:11:09.148 [pkcs15-init] card.c:231:sc_connect_card: returning with: -1100 (Generic reader error)
Failed to connect to card: Generic reader error

openct-tool list

biiont@bitheap ~ % openct-tool list
  0 Rutoken S driver

opensc-tool -l

biiont@bitheap ~ % opensc-tool -l  
0xb72536c0 14:12:55.673 [opensc-tool] ctx.c:659:sc_context_create: ===================================
0xb72536c0 14:12:55.673 [opensc-tool] ctx.c:660:sc_context_create: opensc version: 0.12.2
0xb72536c0 14:12:55.673 [opensc-tool] reader-pcsc.c:657:pcsc_init: PC/SC options: connect_exclusive=0 disconnect_action=1 transaction_end_action=0 reconnect_action=0 enable_pinpad=1
0xb72536c0 14:12:55.673 [opensc-tool] reader-pcsc.c:870:pcsc_detect_readers: called
0xb72536c0 14:12:55.673 [opensc-tool] reader-pcsc.c:878:pcsc_detect_readers: Probing pcsc readers
0xb72536c0 14:12:55.673 [opensc-tool] reader-pcsc.c:900:pcsc_detect_readers: Establish pcsc context
0xb72536c0 14:12:55.674 [opensc-tool] reader-pcsc.c:948:pcsc_detect_readers: Found new pcsc reader 'Aktiv Rutoken S 00 00'
0xb72536c0 14:12:55.674 [opensc-tool] reader-pcsc.c:277:refresh_attributes: Aktiv Rutoken S 00 00 check
0xb72536c0 14:12:56.074 [opensc-tool] reader-pcsc.c:301:refresh_attributes: current  state: 0x00000022
0xb72536c0 14:12:56.074 [opensc-tool] reader-pcsc.c:302:refresh_attributes: previous state: 0x00000000
0xb72536c0 14:12:56.074 [opensc-tool] reader-pcsc.c:356:refresh_attributes: card present, changed
0xb72536c0 14:12:56.074 [opensc-tool] reader-pcsc.c:979:pcsc_detect_readers: Requesting reader features ... 
0xb72536c0 14:12:56.074 [opensc-tool] reader-pcsc.c:993:pcsc_detect_readers: Aktiv Rutoken S 00 00:SCardConnect(SHARED): 0x8010000f
0xb72536c0 14:12:56.074 [opensc-tool] reader-pcsc.c:1023:pcsc_detect_readers: returning with: 0 (Success)
# Detected readers (pcsc)
Nr.  Card  Features  Name
0xb72536c0 14:12:56.074 [opensc-tool] sc.c:195:sc_detect_card_presence: called
0xb72536c0 14:12:56.074 [opensc-tool] reader-pcsc.c:364:pcsc_detect_card_presence: called
0xb72536c0 14:12:56.074 [opensc-tool] reader-pcsc.c:277:refresh_attributes: Aktiv Rutoken S 00 00 check
0xb72536c0 14:12:56.475 [opensc-tool] reader-pcsc.c:293:refresh_attributes: returning with: 0 (Success)
0xb72536c0 14:12:56.475 [opensc-tool] reader-pcsc.c:369:pcsc_detect_card_presence: returning with: 1
0xb72536c0 14:12:56.475 [opensc-tool] sc.c:200:sc_detect_card_presence: returning with: 1
0    Yes             Aktiv Rutoken S 00 00
0xb72536c0 14:12:56.475 [opensc-tool] ctx.c:737:sc_release_context: called
0xb72536c0 14:12:56.475 [opensc-tool] reader-pcsc.c:736:pcsc_finish: called

opensc-tool -n

biiont@bitheap ~ % opensc-tool -n
0xb73046c0 14:13:02.097 [opensc-tool] ctx.c:659:sc_context_create: ===================================
0xb73046c0 14:13:02.097 [opensc-tool] ctx.c:660:sc_context_create: opensc version: 0.12.2
0xb73046c0 14:13:02.097 [opensc-tool] reader-pcsc.c:657:pcsc_init: PC/SC options: connect_exclusive=0 disconnect_action=1 transaction_end_action=0 reconnect_action=0 enable_pinpad=1
0xb73046c0 14:13:02.097 [opensc-tool] reader-pcsc.c:870:pcsc_detect_readers: called
0xb73046c0 14:13:02.097 [opensc-tool] reader-pcsc.c:878:pcsc_detect_readers: Probing pcsc readers
0xb73046c0 14:13:02.097 [opensc-tool] reader-pcsc.c:900:pcsc_detect_readers: Establish pcsc context
0xb73046c0 14:13:02.097 [opensc-tool] reader-pcsc.c:948:pcsc_detect_readers: Found new pcsc reader 'Aktiv Rutoken S 00 00'
0xb73046c0 14:13:02.097 [opensc-tool] reader-pcsc.c:277:refresh_attributes: Aktiv Rutoken S 00 00 check
0xb73046c0 14:13:02.498 [opensc-tool] reader-pcsc.c:301:refresh_attributes: current  state: 0x00000022
0xb73046c0 14:13:02.498 [opensc-tool] reader-pcsc.c:302:refresh_attributes: previous state: 0x00000000
0xb73046c0 14:13:02.498 [opensc-tool] reader-pcsc.c:356:refresh_attributes: card present, changed
0xb73046c0 14:13:02.498 [opensc-tool] reader-pcsc.c:979:pcsc_detect_readers: Requesting reader features ... 
0xb73046c0 14:13:02.498 [opensc-tool] reader-pcsc.c:993:pcsc_detect_readers: Aktiv Rutoken S 00 00:SCardConnect(SHARED): 0x8010000f
0xb73046c0 14:13:02.498 [opensc-tool] reader-pcsc.c:1023:pcsc_detect_readers: returning with: 0 (Success)
0xb73046c0 14:13:02.498 [opensc-tool] sc.c:195:sc_detect_card_presence: called
0xb73046c0 14:13:02.498 [opensc-tool] reader-pcsc.c:364:pcsc_detect_card_presence: called
0xb73046c0 14:13:02.498 [opensc-tool] reader-pcsc.c:277:refresh_attributes: Aktiv Rutoken S 00 00 check
0xb73046c0 14:13:02.898 [opensc-tool] reader-pcsc.c:293:refresh_attributes: returning with: 0 (Success)
0xb73046c0 14:13:02.898 [opensc-tool] reader-pcsc.c:369:pcsc_detect_card_presence: returning with: 1
0xb73046c0 14:13:02.898 [opensc-tool] sc.c:200:sc_detect_card_presence: returning with: 1
Using reader with a card: Aktiv Rutoken S 00 00
0xb73046c0 14:13:02.898 [opensc-tool] sc.c:195:sc_detect_card_presence: called
0xb73046c0 14:13:02.898 [opensc-tool] reader-pcsc.c:364:pcsc_detect_card_presence: called
0xb73046c0 14:13:02.898 [opensc-tool] reader-pcsc.c:277:refresh_attributes: Aktiv Rutoken S 00 00 check
0xb73046c0 14:13:03.299 [opensc-tool] reader-pcsc.c:293:refresh_attributes: returning with: 0 (Success)
0xb73046c0 14:13:03.299 [opensc-tool] reader-pcsc.c:369:pcsc_detect_card_presence: returning with: 1
0xb73046c0 14:13:03.299 [opensc-tool] sc.c:200:sc_detect_card_presence: returning with: 1
0xb73046c0 14:13:03.299 [opensc-tool] card.c:115:sc_connect_card: called
0xb73046c0 14:13:03.299 [opensc-tool] reader-pcsc.c:444:pcsc_connect: called
0xb73046c0 14:13:03.299 [opensc-tool] reader-pcsc.c:277:refresh_attributes: Aktiv Rutoken S 00 00 check
0xb73046c0 14:13:03.699 [opensc-tool] reader-pcsc.c:293:refresh_attributes: returning with: 0 (Success)
0xb73046c0 14:13:03.699 [opensc-tool] reader-pcsc.c:466:pcsc_connect: Aktiv Rutoken S 00 00:SCardConnect failed: 0x8010000f
0xb73046c0 14:13:03.699 [opensc-tool] card.c:231:sc_connect_card: returning with: -1100 (Generic reader error)
Failed to connect to card: Generic reader error
0xb73046c0 14:13:03.699 [opensc-tool] ctx.c:737:sc_release_context: called
0xb73046c0 14:13:03.699 [opensc-tool] reader-pcsc.c:736:pcsc_finish: called

Все комманды выполнялись при debug=6 в файле /etc/opensc/opensc.conf


Дистрибутив: Debian Sid.

Версии ПО:
* openct 0.6.20-1.2
* opensc 0.12.2-2
* pcscd 1.8.2-1
* libccid -1.4.5-1  (с установленной библиотекой и удаленной libccid результат одинаков)

Re: linux & openct токен виден но не форматируется

пришлите, пожалуйста, лог команды

$ pkcs15-init --erase-card

(2012-02-08 11:19:23 отредактировано biiont)

Re: linux & openct токен виден но не форматируется

Кирилл Мещеряков пишет:

пришлите, пожалуйста, лог команды

$ pkcs15-init --erase-card

В предыдущем посте был вывод четырех комманд:
$ openct-tool list
$ opensc-tool -l
$ opensc-tool -n
$ pkcs15-init --erase-card

// Разделил code на четыре секции в предыдущем сообщении

Re: linux & openct токен виден но не форматируется

С какими опциями у вас собран opensc? По умолчанию он собирается с поддержкой pcscd, а посему не будет работать через openct. Пришлите, пожалуйста, вывод команды

$ opensc-tool -i