javacardx.framework.ExtendedLength Interface

By implementing the javacardx.apdu.ExtendedLength interface, applets indicate that they are capable of processing, receiving, and replying to extended APDU commands. The Java Card RE does not deliver extended APDU commands to applets that do not implement this interface (it would throw an ISOException with reason code ISO7816.SW_WRONG_LENGTH). In addition, the Java Card RE does not allow applets to send reply data lengths greater than 256, if the interface is not implemented by the applet.

The APDU buffer in Java Card applications reflects the structure of the extended APDU as defined in the ISO/IEC 7816-3 specification. In T=1, this representation is straightforward and precise; however, in T=0, adaptations are needed for some cases.

Specifically, a case 2E APDU sent over T=0 transport will not show its extended LE value in the APDU buffer. Instead, a P3 value of '00' will always be transmitted and interpreted as 32,767 if the applet implements ExtendedLength, or interpreted as 256 if it does not.

The Java Card RE analyzes the APDU type coming into the card and determines its type based on the rules defined in the ISO/IEC 7816-3 specification. Because case 2E commands look like case 2S commands in T=0, the Java Card RE is not able to distinguish this particular case.