BaselineWatch
Desk

4.2.4 Command With PIV Secure Messaging (was: Command with PIV Secure Messaging)

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 changed

Before · SP 800-73-4

Command with PIV Secure Messaging

After · SP 800-73-5

Command withWith PIV Secure Messaging

Control changed

Before · SP 800-73-4

For secure messaging, the secure messaging data field shall be constructed as the concatenation of the following: the BER-TLV encoded encrypted PIV data; 20 the 3-btye BER-TLV encoded L e , as described in Section 4.2.3 , if L e would have been included in a message sent without secure messaging; the 10-byte BER-TLV encoded C-MAC of the command, as described in Section 4.2.3 ; and a new L e field, which shall be one byte and have shall have a value of '00'. 21

The APDU for secure messaging is shown in Figure 3 for the case in which command chaining is not required. The APDU consists of the CLA byte ('0C'), INS, P1, P2, the length of the secure messaging data field (L c '), the secure messaging data field, and the new L e field ('00').

20 The data field may be absent in the case of the VERIFY command. 21 Note that the new Le field is always included in the command, even if Le would have been absent if the command were sent without secure messaging, since a response is always expected, even if the expected response only consists of the BER-TLV encoded status word and response MAC (R-MAC). Figure 3. Single Command under Secure Messaging If the secure messaging data field to be transported is larger than 255 bytes, command chaining will be needed. Figure 4 shows the APDUs for secure messaging for a case in which the length of the secure messaging data field is between 256 and 510 bytes, requiring the data to be fragmented across two APDUs. The APDUs are constructed in the same manner as when fragmentation is not required, except that the CLA byte for the first APDU is '1C', the first APDU contains the first 255 bytes of the secure messaging data field, and the second APDU contains the remaining bytes of the secure messaging data field and the new L e field ('00'). The PIV Card Application provides a two-byte response of '90 00' for the first APDU. After receiving the second APDU the PIV Card Application reconstructs and processes the entire command.

Figure 4. Chained Command under Secure Messaging

After · SP 800-73-5

For secure messaging, the secure messaging data field shallSHALL be constructed as the concatenation of the following: the

•
BER-TLVThe encodedBER-TLV-encoded encrypted PIV data; 2021

21
The data field may be absent in the 3-btyecase BER-TLVof encodedthe LVERIFY ecommand.
•
The 3-btye BER-TLV-encoded Le, as described in Section 4.2.3 , if L eLe would have been included in a message sent without secure messaging;
•
theThe 10-byte BER-TLV encodedBER-TLV-encoded C-MAC of the command, as described in Section 4.2.3 ; and

•
aA new L eLe field, which shallSHALL be one1 byte and have shallSHALL have a value of '00'. 2122

The APDU for secure22 messagingNote isthat shownthe innew FigureLe 3field foris thealways caseincluded in whichthe command chaining is— noteven required.if TheLe APDUwould consistshave ofbeen theabsent CLAif bytethe ('0C'),command INS,were P1,sent P2,without thesecure lengthmessaging of— thesince securea messagingresponse datais fieldalways (Lexpected, ceven '),if the secureexpected messagingresponse dataonly field,consists andof the newBER-TLV-encoded Lstatus eword fieldand response MAC ('00'R-MAC).

20
The data field may be absent in theFigure case3 ofshows the VERIFY command. 21APDU Notefor thatsecure themessaging newwhen Lecommand fieldchaining is alwaysnot includedrequired. inThe theAPDU command,consists evenof ifthe LeCLA wouldbyte have('0C'), beenINS, absentP1, ifP2, the command werelength sentof withoutthe secure messaging, since a response isdata alwaysfield expected(Lc'), even if the expectedsecure responsemessaging onlydata consistsfield, ofand the BER-TLV encoded status word andnew responseLe MACfield (R-MAC'00'). Figure

Fig.
3. Single Commandcommand under Securesecure Messagingmessaging

Command
Ifchaining will be needed if the secure messaging data field to be transported is larger than 255 bytes, command chaining will be needed. Figure 4 shows the APDUs for secure messaging for a case in whichwhen the length of the secure messaging data field is between 256 and 510 bytes, requiringwhich requires the data to be fragmented across two APDUs. The APDUs are constructed in the same manner as when fragmentation is not required, except that the CLA byte for the first APDU is '1C', the first APDU contains the first 255 bytes of the secure messaging data field, and the second APDU contains the remaining bytes of the secure messaging data field and the new L eLe field ('00'). The PIV Card Application provides a two-byte2-byte response of '90 00' for the first APDU. After receiving the second APDU, the PIV Card Application reconstructs and processes the entire command.

FigureFig. 4. Chained Commandcommand under Securesecure Messagingmessaging