Hi, For an outgoing command, when data is to be sent from the card to the host, the card answers a ACK byte (equals to INS), then the actual data bytes.
So after sending the 5 bytes header CLA INS P1 P2 P3, you just have to read one byte from the card: if it is 0x60, then wait. If it the INS you sent, then read the GET RESPONSE data. Else, that's a SW1 (6X,9X) or an error. A consequence is that INS=$6x and INS=$9x are forbidden. At least that's my understanding. Anyone, please correct me if I'm wrong. Regards Sebastien PS: quoting ISO7816-3: After transmitting the header as a string of five characters, the interface device shall wait for a character conveying a procedure byte. There are three types of procedure bytes, see Table 11. If the value is '60', it is a NULL byte. It requests no action on data transfer. The interface device shall wait for a character conveying a procedure byte. If the value is '6X' or '9X', except for '60', it is a SW1 byte. It requests no action on data transfer. The interface device shall wait for a character conveying a SW2 byte. There is no restriction on SW2 value. NOTE ISO/IEC 7816-4 enforces '60' as invalid value of SW1, as well as any value different from '9X' and '6X'. If the value is the value of INS, apart from the values '6X' and '9X', it is an ACK byte. All remaining data bytes if any bytes remain, denoted Di to Dn, shall be transferred subsequently. Then the interface device shall wait for a character conveying a procedure byte. NOTA: this is the case you're requesting. It implies that you MUST know the direction of the transfer, incoming or outgoing. If the value is the exclusive-or of 'FF' with the value of INS, apart from the values '6X' and '9X', it is an ACK byte. Only the next data byte if it exists, denoted Di, shall be transferred. Then the interface device shall wait for a character conveying a procedure byte. NOTA: AFAIK this is not used / supported in modern cards. Any other value is invalid. On Fri, Jul 2, 2010 at 4:31 AM, Wayne <[email protected]> wrote: > Hi there, > Sorry to disturb you. > > I'm comfused to a problem in the ISO7816-3, as regard to T=0 protocol. > It said, a card can response a "60" as NULL procedure byte to extend > waiting time. > And when the should have valid data to send back, such as response to "GET > RESPONSE" command, > how the interface distinguished the NULL PB form narmal data in the > response, which is followed by SW1,SW2. > > Any comment is appreciated. > Thanks. > > B.R. > Wayne > > _______________________________________________ > Muscle mailing list > [email protected] > http://lists.drizzle.com/mailman/listinfo/muscle > >
_______________________________________________ Muscle mailing list [email protected] http://lists.drizzle.com/mailman/listinfo/muscle
