xmlns:atom="http://www.w3.org/2005/Atom" xmlns:atom="http://www.w3.org/2005/Atom"
Textual Amendments
This command is compliant with ISO/IEC 7816-4, but has a restricted usage compared to the command defined in the norm.
The UPDATE BINARY command message initiates the update (erase + write) of the bits already present in an EF binary with the bits given in the command APDU.
[TCS_331] The command can be performed only if the security status satisfies the security attributes defined for the EF for the UPDATE function (If the access control of the UPDATE function includes PRO SM, a secure messaging must be added in the command).
This command enables the IFD to write data into the EF currently selected, without the card verifying the integrity of data received. This plain mode is allowed only if the related file is not marked as ‘ Encrypted ’ .
Byte | Length | Value | Description |
---|---|---|---|
CLA | 1 | ′00h′ | No secure messaging asked |
INS | 1 | ′D6h′ | |
P1 | 1 | ′XXh′ | Offset in bytes from the beginning of the file: most significant byte |
P2 | 1 | ′XXh′ | Offset in bytes from the beginning of the file: least significant byte |
Lc | 1 | ′NNh′ | Lc length of data to Update. Number of bytes to be written |
#6-#(5+NN) | NN | ′XX..XXh′ | Data to be written |
Note: bit 8 of P1 must be set to 0. U.K.
Byte | Length | Value | Description |
---|---|---|---|
SW | 2 | ′XXXXh′ | Status words (SW1, SW2) |
If the command is successful, the card returns ′9000′,
if no EF is selected, the processing state returned is ′6986′,
if the Access Control of the selected file are not satisfied, the command is interrupted with ′6982′,
if the Offset is not compatible with the size of the EF (Offset > EF size), the processing state returned is ′6B00′,
if the size of the data to be written is not compatible with the size of the EF [F3(Offset + Lc > EF size)] the processing state returned is ′6700′,
if an integrity error is detected within the file attributes, the card shall consider the file as corrupted and unrecoverable, the processing state returned is ′6400′ or ′6500′,
if writing is unsuccessful, the processing state returned is ′6581′.
Textual Amendments
This command enables the IFD to write data into the EF currently selected, with the card verifying the integrity of data received. As no confidentiality is required, the data are not encrypted.
Byte | Length | Value | Description |
---|---|---|---|
CLA | 1 | ′0Ch′ | Secure messaging. Asked |
INS | 1 | ′D6h′ | INS |
P1 | 1 | ′XXh′ | Offset in bytes from the beginning of the file: most significant byte |
P2 | 1 | ′XXh′ | Offset in bytes from the beginning of the file: least significant byte |
Lc | 1 | ′XXh′ | Length of the secured data field |
#6 | 1 | ′81h′ | T PV : tag for plain value data |
#7 | L | ′NNh′ or ′81 NNh′ | L PV : length of transmitted data L is 2 bytes if L PV > 127 bytes |
#(7+L)-#(6+L+NN) | NN | ′XX..XXh′ | Plain data value (data to be written) |
#(7+L+NN) | 1 | ′8Eh′ | T CC : tag for cryptographic checksum |
#(8+L+NN) | 1 | ′04h′ | L CC : Length of following cryptographic checksum |
#(9+L+NN)-#(12+L+NN) | 4 | ′XX..XXh′ | Cryptographic checksum (4 most significant bytes) |
Le | 1 | ′00h′ | As specified in ISO/IEC 7816-4 |
Byte | Length | Value | Description |
---|---|---|---|
#1 | 1 | ′99h′ | T SW : tag for status words (to be protected by CC) |
#2 | 1 | ′02h′ | L SW : length of returned status words |
#3-#4 | 2 | ′XXXXh′ | Status words (SW1, SW2) |
#5 | 1 | ′8Eh′ | T CC : tag for cryptographic checksum |
#6 | 1 | ′04h′ | L CC : Length of following cryptographic checksum |
#7-#10 | 4 | ′XX..XXh′ | Cryptographic checksum (4 most significant bytes) |
SW | 2 | ′XXXXh′ | Status words (SW1, SW2) |
The ‘ regular ’ processing states, described for the UPDATE BINARY command with no secure messaging (see point 3.6.3.1), can be returned using the response message structure described above.
Additionally, some errors specifically related to secure messaging can happen. In that case, the processing state is simply returned, with no secure messaging structure involved:
Byte | Length | Value | Description |
---|---|---|---|
SW | 2 | ′XXXXh′ | Status Words (SW1, SW2) |
If no current session key is available, the processing state ′6A88′ is returned,
if some expected data objects (as specified above) are missing in the secure messaging format, the processing state ′6987′ is returned: this error happens if an expected tag is missing or if the command body is not properly constructed,
if some data objects are incorrect, the processing state returned is ′6988′: this error happens if all the required tags are present but some lengths are different from the ones expected,
if the verification of the cryptographic checksum fails, the processing state returned is ′6688′.] ]