Re: Re: T=0 development


[ Follow Ups ] [ BasicCard User Forum ]

Posted by loud (88.11.241.25) on April 03, 2008 at 09:02:07:

In Reply to: Re: T=0 development posted by loud on April 03, 2008 at 08:58:02:

Sorry, but forum engine is not good

Hello, I've try to implement existing T=0 command specification on ZC5.4H, and have a trouble with several commands. The most what I dont know how to create is command to receive data from card... Other words how to initiate command "outgoing data only" ?

1. I know that card contain XX bytes for me, and I need to retrieve it
2. The command form is:
D0 CA 00 00 [XX] where
D0 - Cla,
CA - Ins
P1 = P2 = 00
XX - required data length (may vary)
3. Card contain for example 6 bytes for me
4. Exchage should happens if XX correct
IFD -+ ICC : D0 CA 00 00 06
IFD +- ICC : CA
IFD +- ICC : 01 02 03 04 05 06
IFD +- ICC : 90 00
4. Exchage should happens if XX correct and card have more YY bytes for IFD
IFD -+ ICC : D0 CA 00 00 06
IFD +- ICC : CA
IFD +- ICC : 01 02 03 04 05 06
IFD +- ICC : 96 YY
5. Exchage should happens if XX illegal
IFD -+ ICC : D0 CA 00 00 05
IFD +- ICC : 90 11

I've implement it:
'---------------------------------------------
Public AnswerLength as byte
Public TotalDataLength as byte
Public data(100)as byte

' somewhere AnswerLength changed to 6

Command &HD0 &HCA GetAnswer (Lc=0 , S$)
private i@
S$ = ""
for i@ = 1 to AnswerLength
S$ = S$ + Chr$(data(i@))
next i@
TotalDataLength = TotalDataLength - AnswerLength
SuspendSW1SW2Processing
if TotalDataLength > 0 then
SW1 = &H96 : SW2 = TotalDataLength
else if
SW1SW2 = swCommandOk
end if
End Command

So this work. But I can't check what XX (P3) contain correct value , because in this type of command (outgoing data only), Lc parameter always 0



Follow Ups:


[ Follow Ups ] [ BasicCard User Forum ]