APDU Parsing with the javacard.framework.APDU Class

Because LC in cases 3E and 4E can take a large value, the parameter is sent to the card as a three-byte quantity, in the format of 00 LCh LCl starting at ISO7816.OFFSET_LC.

To get the value of LC and the data offset inside the APDU buffer use these two APIs in javacard.framework.APDU:

  • public short getIncomingLength()

    This API call returns the value of LC as expressed in the APDU, whether it is extended or not.

  • public short getOffsetCdata()

    This API call returns the offset where the first byte of the APDU data segment is found.