Extended APDU Format

Any APDU classified as extended must follow the format defined by ISO/IEC 7816-4:2013 for extended length APDU and summarized in Table 4-1.

Table 4-1 Extended APDU Format

Field Description Number of Bytes

Command Header

Class byte CLA

1

Command Header

Instruction byte INS

1

Command Header

Parameter bytes P1- P2

2

LC Field

Absent for Nc = 0. Present for Nc > 0

0, 1, or 3

Data Field

Absent if Nc = 0, present if Nc >0

Nc

LE Field

Absent for Ne = 0, present for Ne > 0

0, 1, 2 or 3

Response Data

Absent if Nr = 0, present if Nr >0

Nr (max. Ne)

Response Status

Status bytes SW1 SW2

2

Notation

Nc = command data length

Ne = expected response data length

Nr = actual response data length

The encoding rules are defined as:

For LC:

  • If LC field is absent, Nc = 0.

  • If LC is present as one byte with values between 01 and FF, then Nc = 1..255 accordingly, and it will be a short field.

  • If LC is present as an extended field, then it will be three bytes in length: byte one will be 00, bytes two and three will contain a 16-bit value representing the length of the data Nc with values between 1 and 65535.

For LE:

  • If LE is absent, Ne = 0.

  • If LE is one byte:

    • A value between 01 and FF will indicate Ne = 1..255.

    • A value of 00 will indicate Ne = 256.

If LE is an extended field:

  • LC and LE must be in the same format.

  • An LE field value between 0001 and FFFF will indicate Ne = 1..65535.

  • An LE field value of 0000 will indicate Ne= 65536.