Page MenuHome GnuPG

openpgp v2 card bricks after invalid reset apdu
Closed, ResolvedPublic

Description

Hi,
I've found that openpgp v2 card bricks after issue reset sequence from
crypto-stick.com ( https://www.crypto-stick.com/en/faq ).
Result is card which in not recognized by any tools

(scdaemon output). After that issuing normal reset sequence doesn't change anything.

scdaemon[16116]: listening on socket `/tmp/gpg-TOFHTD/S.scdaemon'
scdaemon[16116]: handler for fd -1 started

scdaemon[16116]: PC/SC OPEN failed: unpowered card (0x80100067)

Card is not physically dead and answers to reset command:

$ scriptor
defined(@array) is deprecated at /usr/lib64/perl5/vendor_perl/Chipcard/PCSC.pm
line 69.
(Maybe you should just omit the defined()?)
No reader given: using OMNIKEY CardMan 4321 00 00
Using T=1 protocol
Reading commands from STDIN
RESET

RESET

< OK: 3B DA 18 FF 81 B1 FE 75 1F 03 00 31 C5 73 C0 01 40 00 90 00 0C

$ pcsc_scan
PC/SC device scanner
V 1.4.17 (c) 2001-2009, Ludovic Rousseau <ludovic.rousseau@free.fr>
Compiled with PC/SC lite version: 1.8.8
Scanning present readers...
0: OMNIKEY CardMan 4321 00 00

Sun Feb 2 23:59:41 2014
Reader 0: OMNIKEY CardMan 4321 00 00

  Card state: Card inserted, 
  ATR: 3B DA 18 FF 81 B1 FE 75 1F 03 00 31 C5 73 C0 01 40 00 90 00 0C

....

Possibly identified card (using /usr/share/pcsc/smartcard_list.txt):
3B DA 18 FF 81 B1 FE 75 1F 03 00 31 C5 73 C0 01 40 00 90 00 0C
GnuPG card V2

-----------

Is there any way to unbrick card?
Card S/N: V2.0 0005 00001E1B

Related Objects

Event Timeline

werner removed a project: Bug Report.
werner added a subscriber: werner.

I don't know about the crypto-stick. For the other cards feed

/hex
scd serialno
scd apdu 00 20 00 81 08 40 40 40 40 40 40 40 40
scd apdu 00 20 00 81 08 40 40 40 40 40 40 40 40
scd apdu 00 20 00 81 08 40 40 40 40 40 40 40 40
scd apdu 00 20 00 81 08 40 40 40 40 40 40 40 40
scd apdu 00 20 00 83 08 40 40 40 40 40 40 40 40
scd apdu 00 20 00 83 08 40 40 40 40 40 40 40 40
scd apdu 00 20 00 83 08 40 40 40 40 40 40 40 40
scd apdu 00 20 00 83 08 40 40 40 40 40 40 40 40
scd apdu 00 e6 00 00
scd reset
/echo Disregard the error returned by the next command
scd serialno undefined
scd apdu 00 44 00 00
/echo Card has been reset to factory defaults

this into gpg-connect-agent. You may need to do it a second time after
reinserting the card.

werner lowered the priority of this task from High to Normal.Feb 12 2014, 11:58 AM

And well, using opensc or pcscd stuff might not work. Better use the internal
driver. It is also possible that omnicard readers don't work (for example they
do not work with 2k keys).

My two cardreaders (omnikey 3021 and 4321 v2) seems not supported by scdaemon
directly (scdaemon logs ccid I/O errors for both bricked and live cards)

I've tried to send that apdu's to bricked card via gpg-connect-agent (througt
pcsc daemon) and got unknown scd errors.

After that I've tried to reset my second (worked) card:

/hex
scd serialno

S SERIALNO D276000124010200000500001FDF0000 0
OK

scd apdu 00 20 00 81 08 40 40 40 40 40 40 40 40

D[0000] 69 82 i.
OK

scd apdu 00 20 00 81 08 40 40 40 40 40 40 40 40

D[0000] 69 82 i.
OK

scd apdu 00 20 00 81 08 40 40 40 40 40 40 40 40

D[0000] 69 82 i.
OK

scd apdu 00 20 00 81 08 40 40 40 40 40 40 40 40

D[0000] 69 83 i.
OK

scd apdu 00 20 00 83 08 40 40 40 40 40 40 40 40

D[0000] 69 82 i.
OK

scd apdu 00 20 00 83 08 40 40 40 40 40 40 40 40

D[0000] 69 82 i.
OK

scd apdu 00 20 00 83 08 40 40 40 40 40 40 40 40

D[0000] 69 82 i.
OK

scd apdu 00 20 00 83 08 40 40 40 40 40 40 40 40

D[0000] 69 83 i.
OK

scd apdu 00 e6 00 00

D[0000] 90 00 ..
OK

scd reset

OK

/echo Disregard the error returned by the next command

Disregard the error returned by the next command

scd serialno undefined

ERR 100663356 Not supported <SCD>

scd apdu 00 44 00 00

ERR 100663351 Invalid value <SCD>

/echo Card has been reset to factory defaults

Card has been reset to factory defaults

after that it became bricked too :-(

scdaemon via pcscd:

scdaemon[16985]: chan_7 <- serialno
2014-02-13 12:37:47 scdaemon[16985] DBG: send apdu: c=00 i=A4 p1=00 p2=0C lc=2
le=-1 em=0
2014-02-13 12:37:47 scdaemon[16985] DBG: PCSC_data: 00 A4 00 0C 02 3F 00
2014-02-13 12:37:47 scdaemon[16985] DBG: response: sw=6B00 datalen=0
2014-02-13 12:37:47 scdaemon[16985] DBG: send apdu: c=00 i=A4 p1=04 p2=00 lc=6
le=-1 em=0
2014-02-13 12:37:47 scdaemon[16985] DBG: PCSC_data: 00 A4 04 00 06 D2 76 00 01
24 01
2014-02-13 12:37:47 scdaemon[16985] DBG: response: sw=6285 datalen=0
2014-02-13 12:37:47 scdaemon[16985] DBG: send apdu: c=00 i=A4 p1=04 p2=0C lc=7
le=-1 em=0
2014-02-13 12:37:47 scdaemon[16985] DBG: PCSC_data: 00 A4 04 0C 07 D2 76 00 00
03 01 02
2014-02-13 12:37:47 scdaemon[16985] DBG: response: sw=6B00 datalen=0
2014-02-13 12:37:47 scdaemon[16985] DBG: send apdu: c=00 i=A4 p1=04 p2=0C lc=12
le=-1 em=0
2014-02-13 12:37:47 scdaemon[16985] DBG: PCSC_data: 00 A4 04 0C 0C A0 00 00 00
63 50 4B 43 53 2D 31 35
2014-02-13 12:37:47 scdaemon[16985] DBG: response: sw=6B00 datalen=0
2014-02-13 12:37:47 scdaemon[16985] DBG: send apdu: c=00 i=A4 p1=08 p2=0C lc=2
le=-1 em=0
2014-02-13 12:37:47 scdaemon[16985] DBG: PCSC_data: 00 A4 08 0C 02 2F 00
2014-02-13 12:37:47 scdaemon[16985] DBG: response: sw=6B00 datalen=0
2014-02-13 12:37:47 scdaemon[16985] DBG: send apdu: c=00 i=A4 p1=01 p2=0C lc=2
le=-1 em=0
2014-02-13 12:37:47 scdaemon[16985] DBG: PCSC_data: 00 A4 01 0C 02 50 15
2014-02-13 12:37:47 scdaemon[16985] DBG: response: sw=6B00 datalen=0
2014-02-13 12:37:47 scdaemon[16985] DBG: send apdu: c=00 i=A4 p1=04 p2=0C lc=9
le=-1 em=0
2014-02-13 12:37:47 scdaemon[16985] DBG: PCSC_data: 00 A4 04 0C 09 D2 76 00 00
25 45 50 02 00
2014-02-13 12:37:47 scdaemon[16985] DBG: response: sw=6B00 datalen=0
2014-02-13 12:37:47 scdaemon[16985] DBG: send apdu: c=00 i=A4 p1=04 p2=0C lc=6
le=-1 em=0
2014-02-13 12:37:47 scdaemon[16985] DBG: PCSC_data: 00 A4 04 0C 06 D2 76 00 00
66 01
2014-02-13 12:37:47 scdaemon[16985] DBG: response: sw=6B00 datalen=0
2014-02-13 12:37:47 scdaemon[16985] no supported card application found: Invalid
value
scdaemon[16985]: chan_7 -> ERR 100663351 Invalid value <SCD>
scdaemon[16985]: chan_7 <- RESTART
scdaemon[16985]: chan_7 -> OK

---------

scdaemon directly:

----------

scdaemon[17272]: chan_7 <- serialno
2014-02-13 12:44:41 scdaemon[17272] reader slot 0: using ccid driver
2014-02-13 12:44:41 scdaemon[17272] slot 0: ATR=3B DA 18 FF 81 B1 FE 75 1F 03 00
31 C5 73 C0 01 40 00 90 00 0C
2014-02-13 12:44:41 scdaemon[17272] DBG: send apdu: c=00 i=A4 p1=00 p2=0C lc=2
le=-1 em=0
2014-02-13 12:44:41 scdaemon[17272] DBG: raw apdu: 00 A4 00 0C 02 3F 00
2014-02-13 12:44:46 scdaemon[17272] ccid_transceive failed: (0x1000a)
2014-02-13 12:44:46 scdaemon[17272] apdu_send_simple(0) failed: card I/O error
2014-02-13 12:44:46 scdaemon[17272] DBG: send apdu: c=00 i=A4 p1=04 p2=00 lc=6
le=-1 em=0
2014-02-13 12:44:46 scdaemon[17272] DBG: raw apdu: 00 A4 04 00 06 D2 76 00 01 24 01
2014-02-13 12:44:51 scdaemon[17272] ccid_transceive failed: (0x1000a)
2014-02-13 12:44:51 scdaemon[17272] apdu_send_simple(0) failed: card I/O error
2014-02-13 12:44:51 scdaemon[17272] DBG: send apdu: c=00 i=A4 p1=04 p2=0C lc=7
le=-1 em=0
2014-02-13 12:44:51 scdaemon[17272] DBG: raw apdu: 00 A4 04 0C 07 D2 76 00 00
03 01 02
2014-02-13 12:44:56 scdaemon[17272] ccid_transceive failed: (0x1000a)
2014-02-13 12:44:56 scdaemon[17272] apdu_send_simple(0) failed: card I/O error
2014-02-13 12:44:56 scdaemon[17272] DBG: send apdu: c=00 i=A4 p1=04 p2=0C lc=12
le=-1 em=0
2014-02-13 12:44:56 scdaemon[17272] DBG: raw apdu: 00 A4 04 0C 0C A0 00 00 00
63 50 4B 43 53 2D 31 35
2014-02-13 12:45:01 scdaemon[17272] ccid_transceive failed: (0x1000a)
2014-02-13 12:45:01 scdaemon[17272] apdu_send_simple(0) failed: card I/O error
2014-02-13 12:45:01 scdaemon[17272] DBG: send apdu: c=00 i=A4 p1=08 p2=0C lc=2
le=-1 em=0
2014-02-13 12:45:01 scdaemon[17272] DBG: raw apdu: 00 A4 08 0C 02 2F 00
2014-02-13 12:45:06 scdaemon[17272] ccid_transceive failed: (0x1000a)
2014-02-13 12:45:06 scdaemon[17272] apdu_send_simple(0) failed: card I/O error
2014-02-13 12:45:06 scdaemon[17272] DBG: send apdu: c=00 i=A4 p1=01 p2=0C lc=2
le=-1 em=0
2014-02-13 12:45:06 scdaemon[17272] DBG: raw apdu: 00 A4 01 0C 02 50 15
2014-02-13 12:45:11 scdaemon[17272] ccid_transceive failed: (0x1000a)
2014-02-13 12:45:11 scdaemon[17272] apdu_send_simple(0) failed: card I/O error
2014-02-13 12:45:11 scdaemon[17272] DBG: send apdu: c=00 i=A4 p1=04 p2=0C lc=9
le=-1 em=0
2014-02-13 12:45:11 scdaemon[17272] DBG: raw apdu: 00 A4 04 0C 09 D2 76 00 00
25 45 50 02 00
2014-02-13 12:45:16 scdaemon[17272] ccid_transceive failed: (0x1000a)
2014-02-13 12:45:16 scdaemon[17272] apdu_send_simple(0) failed: card I/O error
2014-02-13 12:45:16 scdaemon[17272] DBG: send apdu: c=00 i=A4 p1=04 p2=0C lc=6
le=-1 em=0
2014-02-13 12:45:16 scdaemon[17272] DBG: raw apdu: 00 A4 04 0C 06 D2 76 00 00 66 01
2014-02-13 12:45:21 scdaemon[17272] ccid_transceive failed: (0x1000a)
2014-02-13 12:45:21 scdaemon[17272] apdu_send_simple(0) failed: card I/O error
2014-02-13 12:45:21 scdaemon[17272] no supported card application found: Ошибка
ввода/вывода
scdaemon[17272]: chan_7 -> ERR 100696113 Ошибка ввода/вывода <SCD>
scdaemon[17272]: chan_7 <- RESTART
scdaemon[17272]: chan_7 -> OK

svpcom added a project: Bug Report.

Cards are openpgp cards from http://g10code.com/p-card.html
S/N:
V2.0 0005 00001E1B
V2.0 0005 00001FDF

Omnicard based readers do not work with Linux if you use keys >= ~2k. Actually
they have lot of problems. On Windows they work, though.