# Fwd: Do OpenPGP cards support T=0?

Sébastien Lorquet squalyl at gmail.com
Mon Mar 7 15:35:31 CET 2011

```It's not that difficult, it's based on a set of bitmaps. OK, it's awful, I
know.

I guess the ATR is the one that was posted on the muscle mailing list:

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

Here we go:

First byte is Ts, 3B means direct convention (bits on wire are as on
RS-232), 3F means inverse convention (bits on wire are in negative logic and
bit endian is reversed, very few cards use this today)

Then you have T0 = 0xDA. 0xD encodes a Y[1] bitfield and 0xA encodes the
number of historical bytes (10) that will follow the initial sequence of
"interface bytes".

The Y[1] bitfield is 0xD = 0b1101. That means, this byte is followed by 3
other bytes: TD[1], TC[1] and TA[1]. TB[1] is not present (deprecated as per
ISO7816-3).

TA[1] = 0x18 : encodes Fi and Di to calculate the baud rate.
TC[1] = 0xFF : encodes N (extra guard time)
TD[1] = 0x81 : Y[2]=1000 -> we now have TD[2], while TC[2], TB[2] and TA[2]
are absent. T=1 is supported by default.
TD[2] = 0xB1 : Y[3] = 1011 -> we now have TD[3], TB[3], TA[3], and again T=1
is supported.
TA[3] = 0xFE : don't know...
TB[3] = 0x75 :  don't know...
TD[3] = 0x1F, Y[4] = 0001 -> we have TA[4]  and no TD[4] (end of sequence)
and T=15 meaning global info
TA[4] = 0x03 = 0b00 000011, for T=15 this means clock stop is not supported,
classes A and B supported (5 volts and 3.3 volts)

"00 31 C5 73 C0 01 40 00 90 00"  are the 10 historical bytes including a
dummy SW "9000"

0C is TCK, the XOR of all bytes in the ATR including TCK shall result in
0x00.

So as already said, we now have the proof that this card does not claim to
support T=0.

Sebastien

On Mon, Mar 7, 2011 at 2:48 PM, Werner Koch <wk at gnupg.org> wrote:

> On Sun,  6 Mar 2011 19:48, kgo at grant-olson.net said:
>
> > Thanks for all the info.  I suspected the ATR had the info, but the only
> > public doc I could find explaining the ATR format was really difficult
> > to understand.
>
> The only freely available specs I know of are the EMV specs
> (www.emvco.com).  The ISO specs are a bit expensive but even harder to
> read.  gnupg/scd/atr.c has a function to print the ATR in a human
> readable format.  There is also an old project by me with a very similar
> tool (ftp://ftp.g10code.com/g10code/gscutils/).
>
>
> Shalom-Salam,
>
>   Werner
>
> --
> Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.
>
>
> _______________________________________________
> Gnupg-devel mailing list
> Gnupg-devel at gnupg.org
> http://lists.gnupg.org/mailman/listinfo/gnupg-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/attachments/20110307/830148d0/attachment.htm>
```