Site Tools

Sidebar

Smart Card Solution

User Manual

JavaCard API Samples

Java Card Specification

Knowledge Sharing

javacard:jcre:9.4.4.1_extended_length_api_semantics

9.4.4.1 Extended Length API Semantics

The following sections describe the semantics of the applet-visible API, which is enabled when the applet implements the javacardx.apdu.ExtendedLength interface. These semantics are presented at the API level to the extended length capable applet, only when the APDU received supports extended length format. Note that the maximum length that can be supported using extended length semantics by the Java Card technology API is 32767.

Applet.process_APDU_Method

When the APDU received is a Case 3E or 4E, and contains an Lc encoding of extended length, the APDU buffer contained in the APDU object upon entry into the Applet.process(APDU) method shall encode the header data format as described in ISO 7816-3 Specification in its first seven bytes, as shown in the TABLE 9-1.

When the T=0 transfer protocol is in use, a Case 3E and 4E APDU is enclosed within an ENVELOPE (ISO Inter-industry CLA, INS=0xC2) command as described in ISO 7816-4:2005 Specification. The ENVELOPE command header is processed by the Java Card RE and only the enclosed Case 3E or Case 4E APDU command is placed in the APDU buffer using the format shown in TABLE 9-1.

offset=0

offset=1

offset=2

offset=3

offset=4

offset=5

offset=6

offset=7..

CLA

INS

P1

P2

3 byte Lc

undefined

As shown in the table, the header data at offset 4, 5 and 6 of the APDU buffer contains a 3-byte Lc value as defined in ISO 7816-4. The 3-byte length may encode a number from 1to 32767.

APDU.setIncomingAndReceive_ Method

This method returns the number of bytes received. The returned number may be between 0 and 32767. Additionally, when the 3 byte Lc format is used, the data bytes received are placed at OFFSET_EXT_CDATA (7) of the APDU buffer.

APDU.receiveBytes_short_Method

This method returns the number of bytes received. The returned number may be between 0 and 32767.

APDU.setOutgoing_ Method

These methods return the number of bytes expected (Le) by the CAD. The returned number may be between 0 and 32767.

When the T=0 transfer protocol is in use for a Case 2E (P3=0) or Case 4 command, this method returns 32767.

When the T=1 transfer protocol is in use for a Case 2E or Case 4E command and Le is set to 0x0000, this method returns 32767.

APDU.setOutgoingLength_short_Method

This method allows the caller to specify the number of bytes to send to the CAD. The number specified may be between 0 and 32767.

APDU.sendBytes_short_short_ APDU.sendBytesLong_byte[]_short_ short_ Methods

These methods allow the caller to specify the number of bytes to send to the CAD. The number specified may be between 0 and 32767.

2767.

javacard/jcre/9.4.4.1_extended_length_api_semantics.txt · Last modified: 2017/05/13 04:07 (external edit)