ISO/IEC 7816-4
Identification cards — Integrated circuit cards — Part 4: Organization, security and commands for interchange
Cartes d’identification — Cartes à circuit intégré — Partie 4: Organisation, sécurité et commandes pour les échanges

ERASE RECORD (S) command
The command sets one or more records of an EF to the logical erased state, either the record referenced by P1, or the sequence of records from P1, sequentially, up to the end of the file. Erased records shall not be deleted, and may still be accessible by WRITE RECORD and UPDATE RECORD commands.

Table 60 ERASE RECORD (S) command-response pair
CLA INS P1 P2 As defined in 5.1.1 ’0C’ Record number See Table 61
Lcfield Absent for encoding Nc= 0
Data field Absent
Lefield Absent for encoding Ne= 0
Data field Absent
SW1-SW2 See Tables 5 and 6 when relevant, e.g., ’63CX’ (see 7.3.2), ’6581′, ’6700′, ’6981′, ’6982′, ’6986′, ’6A81′, ’6A82′, ’6A83, ’6A84′, ’6A85′

 

Table 61 P2
b8 b7 b6 b5 b4 b3 b2 b1 Meaning
x x x x x Short EF identifier according to Table 47
————— 1 x x 1 0 0 1 0 1 Record number in P1 —Erase record P1 —Erase all records from P1 up to the last
Any other value is reserved for future use by ISO/IEC JTC 1/SC 17.

Data object handling
Any command of this group shall be aborted if applied to a structure (DF or EF) not supporting data objects. It can be performed only if the security status satisfies the security conditions defined by the application within the context for the function.
INS P1 P2——All the commands of this group may use an odd INS code (see 5.1.2). Bit 1 of INS shall be used together with P1-P2 according to Table 62

Table 62 — P1-P2
Condition Value of P1-P2 Meaning
Even INS code ’0000′ ’0040′ to ’00FF’ ’0100′ to ’01FF’ ’0200′ to ’02FF’ ’4000′ to ‘FFFF’ Used for dumping a file (see 8.4), or for card-originated byte strings (see 8.6) BER-TLVtag (one byte) in P2 Proprietary SIMPLE-TLVtag in P2 BER-TLVtag (two bytes) in P1-P2
Odd INS code Any value File identifier or short EF identifier (see text below)
Any other value is reserved for future use by ISO/IEC JTC 1/SC 17.

GET DATA command
The command retrieves either the content of an EF supporting data objects, or one data object, possibly constructed, within the current context (e.g., application-specific environment or current DF).
NOTE: If the information is too long for a single response data field, then the card shall return the beginning of the information followed by SW1-SW2 set to ’61XX’. Then a subsequent GET RESPONSE provides ‘XX’ bytes of information. The process may be repeated until the card sends SW1-SW2 set to ’9000′.

If INS = ‘CB’, then the command data field shall contain either a tag list data object, or a header list data object, or an extended header list data object (tags ’5C’, ’5D’, ’4D’, see 8.5.1).
–In the tag list case, the response data field shall be the concatenation of the data objects referenced in the tag list, in the same order (one or more data objects may be absent). An empty tag list requires all the available data objects.
 In the header list case, the response data field shall be the concatenation of the truncated data objects referenced in the header list, in the same order (one or more data objects may be absent).
–In the extended header list case, the response data field shall be the concatenation of the data objects derived from the extended header list according to 8.5.1.

When there are several occurrences of a tag, this clause does not define which data object is returned because that depends on the definition or the nature or the content of the data object.

If the physical interface does not allow the card to answer to reset, e.g., a universal serial bus or an access by radio frequency, then the GET DATA command may retrieve specific information in the card according to P1-P2. Either one of the following specific information may be retrieved in the card.

–With INS = ‘CA’,
Tag ’5F51′ –the Answer-to-Reset is a string of up to 32 bytes according to ISO/IEC 7816-3.
Tag ’5F52′ –the historical bytes are a string of up to 15 bytes according to 8.1.1.
–With INS = ‘CB’ and an empty tag list, i.e., ’5C00′, in the command data field,
–File identifier ’2F00′–the content of EF.DIR is a set of BER-TLV data objects according to 8.2.1.1.
–File identifier ’2F01′–the content of EF.ATR is a set of BER-TLV data objects according to 8.2.1.1.
NOTE: 1 (Background Information) According to the physical interface specified in ISO/IEC 7816-3, the card answers to any cold or warm reset operation through the contacts. The answer to reset is a sequence of asynchronous characters. The initial character TS indicates conventions for decoding bytes in characters and offers an alternate measurement of the elementary time unit. Despite it may be decoded according to the indicated conventions, TS is a synchronization pattern, not a byte. According to ISO/IEC 7816-3, the Answer-to-Reset is the string of up to 32 bytes conveyed by the answer to reset, namely a mandatory format byte T0 followed by optional interface bytes, optional historical bytes (up to 15 historical bytes encoded according to 8.1.1) and a conditional check byte TCK. When TCK is present, the exclusive-oring of all the bytes T0 to TCK inclusive is null.

NOTE 2 For ATR information, if the Le field encodes a number less than the exact length, then rather than returning the beginning of the information followed by SW1-SW2 set to ’61XX’, the card should preferably abort the command by returning only SW1-SW2 set to ’6CYY’ for indicating the exact number of available data bytes. However, ’6C00′ indicates 256 bytes or more. If it is more than 256, then SW1-SW2 set to ’61XX’ indicates that ‘XX’ bytes are still available.

If the Le field contains only bytes set to ’00′, then all the required information should be returned within the limit of 256 for a short Le field, or 65 536 for an extended Le field.

Table 63 GET DATA command-response pair
CLA INS P1-P2 As defined in 5.1.1 ‘CA’ or ‘CB’ See Table 62
Lc field Absent for encoding Nc= 0, present for encoding Nc> 0
Data field Absent (INS = ‘CA’), or tag list data object or (extended) header list data object (INS = ‘CB’)
Le field Present for encoding Ne> 0
Data field Data bytes according to P1-P2 (INS = ‘CA’), or concatenation of BER-TLVdata objects (INS = ‘CB’)
SW1-SW2 See Tables 5 and 6 when relevant, e.g., ’61XX’, ’6202′ to ’6280′, ’6281′, ’6700′, ’6981′, ’6982′, ’6985′, ’6A81′, ’6A88′ (data objects not found, i.e., referenced data not found), ’6CXX’