APDU

Prologue

I assume that reader are familiar with smart card basic and its terms (if not take a look:Ciao to Smart card).In this blog I have briefed about smart card communion protocol, a vital player in smart card application.

Application Protocol Data Unit (in short APDU) facilitates Smart card communions under ISO7816 compliant. In general scenario Smart card is inactive until it is inserted into CAD and only CAD makes command (as a first action) to smart card in APDU format (APDU command) and gets the response in APDU format (APDU response). Host application initiates CAD to sent APDU command to smart card when smart card data is needed. CAD sends back the response to host application when it gets the APDU response from smart card.

Communication of smart card with APDU

Communication of smart card with APDU

Communication mode between CAD and card is half duplexed (however resent development on High-End Smart Card Hardware support full duplexed ).As per clock cycle of the system ( T=1, T=0 ) APDU actions are proceeded.

Structure of APDU command

APDU command

APDU command

CLA: Class byte, used to identify the application.

INS: Instruction byte, used to indicate the instruction code.

P1-P2: Parameter bytes, to provide further qualification of the APDU.

Lc: Indicates the number of bytes in the data field.

Data field: The slot where data is actually allocated in the package.

Le: The maximum number of bytes expected in the data field in the next response APDU.

Note: you will understand CLA, INS when your program your smart card application class.

In laymen term APDU command invokes the class (e.g. java applet class) in which tasks (functions) to be performed are defined.

Structure of APDU response

APDU Response

APDU Response

SW: status word indicates the status of process.

Eg. 90, 00 on status word indicate normal processing

65,XX on status word indicate error in execution

In laymen term APDU response carry the values returned tasks (functions) of class (e.g. java applet class) with status window.

Data field is optional in both APDU command and APDU response. Therefore there are four possible cases during communication

Case 1 APDU command without data APDU response without data
Case 2 APDU command with data APDU response without data
Case 3 APDU command without data APDU response with data
Case 4 APDU command with data APDU response with data

3 Comments

  1. Lakshmi wrote
    at 8:11 AM - 17th December 2009 Permalink

    Really nice ,very neat explanation…:)
    pls kindly post an example program that use apdu
    looking forward for ur next blogs ..keep updating me:)

  2. shakthydoss wrote
    at 6:24 AM - 18th December 2009 Permalink

    Thank you, for showing such interest. I will consider your suggestion and try to post an example program possibly 

  3. Shashank wrote
    at 2:31 PM - 25th December 2009 Permalink

    Nice … pretty distinct & comprehensible approach on the subject. Well explained.

    Keep updating …
    Looking forward for more 🙂

Post a Comment

Your email is never published nor shared. Required fields are marked *