Page 1 of 1

How to know the APDU length that has been sent to the application?

Posted: Mon Oct 09, 2017 11:54 pm
by colkif
Hi friends here. It's me again.

I wonder how to know the APDU length that has been sent to my application? Thanks.

Re: How to know the APDU length that has been sent to the application?

Posted: Tue Oct 10, 2017 1:16 am
by tomc2016
Use the code below to know the length of data field.

Code: Select all

process(Apdu apdu)
{
    // Lc tells us the incoming apdu command length
     short bytesLeft = (short) (buffer[ISO7816.OFFSET_LC] & 0x00FF);
   // you may also use APDU class method
       short readCount = apdu.setIncomingAndReceive();
}

Re: How to know the APDU length that has been sent to the application?

Posted: Tue Oct 10, 2017 5:45 am
by Heerden
It's better for you to look through Java card API specification.