xmlns:atom="http://www.w3.org/2005/Atom" xmlns:atom="http://www.w3.org/2005/Atom"
This command enables the IFD to write data into the EF currently selected, without the card verifying the integrity of data received.
Note: This command without secure messaging can only be used to update a file that supports the ALW security condition for the Update access mode.U.K.
Byte | Length | Value | Description |
---|---|---|---|
CLA | 1 | ‘00h’ | |
INS | 1 | ‘D6h’ | Update Binary |
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 security conditions 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 (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’.
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’ | Update Binary |
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’ | TPV: Tag for plain value data |
#7 | L | ‘NNh’ or ‘81 NNh’ | LPV: length of transmitted data. L is 2 bytes if LPV > 127 bytes. |
#(7+L)-#(6+L+NN) | NN | ‘XX..XXh’ | Plain Data value (Data to be written) |
#(7+L+NN) | 1 | ‘8Eh’ | TCC: Tag for cryptographic checksum |
#(8+L+NN) | 1 | ‘XXh’ | LCC: Length of following cryptographic checksum‘04h’ for Generation 1 secure messaging (see Appendix 11 Part A) ‘08h’, ‘0Ch’ or ‘10h’ depending on AES key length for Generation 2 secure messaging (see Appendix 11 Part B) |
#(9+L+NN)-#(8+M+L+NN) | M | ‘XX..XXh’ | Cryptographic checksum |
Le | 1 | ‘00h’ | As specified in ISO/IEC 7816-4 |
Byte | Length | Value | Description |
---|---|---|---|
#1 | 1 | ‘99h’ | TSW: Tag for Status Words (to be protected by CC) |
#2 | 1 | ‘02h’ | LSW: length of returned Status Words |
#3-#4 | 2 | ‘XXXXh’ | Processing Status of the unprotected response APDU |
#5 | 1 | ‘8Eh’ | TCC: Tag for cryptographic checksum |
#6 | 1 | ‘XXh’ | LCC: Length of following cryptographic checksum
|
#7-#(6+L) | L | ‘XX..XXh’ | Cryptographic checksum |
SW | 2 | ‘XXXXh’ | Status Words (SW1,SW2) |
The ‘regular’ processing states, described for the UPDATE BINARY command with no secure messaging (see §3.5.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’.