BaselineWatch
Desk

4.2.2 Command and Response Data Confidentiality

NIST PIV and digital identity SP 800-73-5 against SP 800-73-4
All changes in this version
modified 4 Secure Messaging part of 4.2

Title

Command and Response Data Confidentiality

Control changed

Before · SP 800-73-4

Under secure messaging, the PIV data is encrypted using AES in Cipher Block Chaining (CBC) mode with the SK ENC session key, where SK ENC is a 128-bit key for CS2 and a 256-bit key for CS7 as per Table 14 . The encryption and encoding process for command data and response data shall be the same. The encryption of the command data or response data and encoding in BER-TLV format is illustrated Figure 1 . The encryption shall be computed over the entire message before applying fragmentation for data transportation. Figure 1. PIV Data Confidentiality Initialization Vector (IV): The IV for the AES CBC encryption of command data shall be generated by applying the AES block cipher to a 16-byte encryption counter. The initial value of the encryption counter upon successful completion of the key establishment protocol shall be '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01'. The encryption counter shall be incremented by one after each APDU sent over secure messaging (except for the GET RESPONSE command and APDUs with a CLA of '1C'), and it shall be reset to its initial value after each successful completion of the key establishment protocol. The 16-byte IV shall be created by encrypting the encryption counter with SK ENC using AES in the electronic codebook (ECB) mode of operation.

The IV for the AES CBC encryption of response data shall also be generated by encrypting an encryption counter with SK ENC using AES in the ECB mode of operation. The encryption counter value used to generate the IV to encrypt the response data shall be the same as the encryption counter value used to generate the IV to encrypt the corresponding request data, with the exception that the most significant byte of the 16-byte counter shall be set to '80' (i.e., the IV used to encrypt the first response after successful completion of the key establishment protocol shall be generated by encrypting '80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01' with SK ENC ).

Padding: Prior to encryption, one to sixteen bytes of padding data shall be appended to the PIV data. The padding shall be '80' followed by the number of zeros needed to make the total length of the message to be encrypted (PIV data plus padding) a multiple of sixteen bytes. The first byte of the value field of tag '87', the padding-content indicator byte, shall be '01' to indicate that padding has been applied. As illustrated in Figure 1 , the input and output of encryption is as follows:

• Encryption input: Plain Text
• Encryption output: BER-TLV encoded encrypted message, which consists of tag '87' followed by the length of the encoded encrypted message (L cc + 1), the padding indicator byte ('01'), and then the encrypted data. L cc is the length of the encrypted PIV data; it shall be a multiple of 16.

After · SP 800-73-5

Under secure messaging, the PIV data is encrypted using AES in Cipher Block Chaining (CBC) mode with the SK ENCSKENC session key, where SK ENCSKENC is a 128-bit key for CS2 and a 256-bit key for CS7, as per Table 1418 . The encryption and encoding process for command data and response data shallSHALL be the same. The encryption of the command data or response data and encoding in BER-TLV format is illustrated FigureFig. 1 . The encryption shallSHALL be computed over the entire message before applying fragmentation for data transportation. Figure

Fig.
1. PIV Data Confidentialitydata confidentiality

Initialization Vector (IV):. The IV for the AES CBC encryption of command data shallSHALL be generated by applying the AES block cipher to a 16-byte encryption counter. The initial value of the encryption counter upon successful completion of the key establishment protocol shallSHALL be '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01'. The encryption counter shallSHALL be incremented by one after each APDU sent over secure messaging (except for the GET RESPONSE command and APDUs with a CLA of '1C'), and it shallSHALL be reset to its initial value after each successful completion of the key establishment protocol. The 16-byte IV shallSHALL be created by encrypting the encryption counter with SK ENCSKENC using AES in the electronic codebook (ECB) mode of operation.

The IV for the AES CBC encryption of response data shallSHALL also be generated by encrypting an encryption counter with SK ENCSKENC using AES in the ECB mode of operation. The encryption counter value used to generate the IV to encrypt the response data shallSHALL be the same as the encryption counter value used to generate the IV to encrypt the corresponding request data, with the exception that the most significant byte of the 16-byte counter shallSHALL be set to '80' (i.e., the IV used to encrypt the first response after successful completion of the key establishment protocol shallSHALL be generated by encrypting '80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01' with SK ENC SKENC).

Padding:. Prior to encryption, one1 to– sixteen16 bytes of padding data shallSHALL be appended to the PIV data. The padding shallSHALL be '80' followed by the number of zeros needed to make the total length of the message to be encrypted (i.e., PIV data plus padding) a multiple of sixteen16 bytes. The first byte of the value field of tag '87', — the padding-contentpadding content indicator byte, shall— SHALL be '01' to indicate that padding has been applied.

As illustrated in FigureFig. 1 , the input and output of encryption isare as follows:

• Encryption input:

Plain Text


• Encryption output: BER-TLV encoded

BER-TLV-encoded
encrypted message, which consists of tag '87' followed by the length of the encoded encrypted message (L ccLcc + 1), the padding indicator byte ('01'), and then the encrypted data. L ccLcc is the length of the encrypted PIV data; it shallSHALL be a multiple of 16.