29.01.2015 Views

Applications & SmartCard : JavaCard - Identification - LIFL

Applications & SmartCard : JavaCard - Identification - LIFL

Applications & SmartCard : JavaCard - Identification - LIFL

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>JavaCard</strong>.Framework.APDU<br />

• Encapsulates 7816-4 APDU elements in pre-created I/O<br />

<strong>JavaCard</strong>.Framework.APDU<br />

• APDU buffer is handled by the JCRE as a global array<br />

buffer<br />

• APDU = communication packet between on-card and<br />

off-card applications<br />

Incoming APDU<br />

ISO standards<br />

APDU Buffer<br />

CLA INS P1 P2 P3<br />

• Contains methods for sending and receiving data<br />

• Hides the low level details of the protocol used<br />

• APDU objects are owned by the JCRE<br />

• To have a reference on the APDU buffer in the applet<br />

getBuffer()<br />

Return the APDU buffer byte array, filled with APDU<br />

header<br />

http://www.lifl.fr/~grimaud/Cours<br />

<strong>JavaCard</strong> System & Framework 21<br />

http://www.lifl.fr/~grimaud/Cours<br />

<strong>JavaCard</strong> System & Framework 22<br />

<strong>JavaCard</strong>.Framework.APDU<br />

• process() method is called<br />

• getBuffer()<br />

• INS is examined<br />

CLA INS P1 P2 L<br />

Process( )<br />

INS = V1<br />

INS = Vx<br />

INS =V2<br />

Method1( )<br />

Methodx( )<br />

Method2( )<br />

<strong>JavaCard</strong>.Framework.APDU<br />

Buffer<br />

• To retrieve incoming data (for ISO cases 2 and 4)<br />

setIncomingAndReceive()<br />

Sets the transfer direction to inbound<br />

Receives the incoming data in the APDU buffer at offset = 4<br />

byte bLength = (byte)_apdu.setIncomingAndReceive();<br />

byte bData = baBuffer[ISO7816.OFFSET_CDATA];<br />

OR<br />

receiveBytes(short offset)<br />

Sets the transfer direction to inbound<br />

Receives the incoming data in the APDU buffer at user offset<br />

http://www.lifl.fr/~grimaud/Cours<br />

<strong>JavaCard</strong> System & Framework 23<br />

http://www.lifl.fr/~grimaud/Cours<br />

<strong>JavaCard</strong> System & Framework 24

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!