3.2.4 GENERAL AUTHENTICATE Card Command
All changes in this version
Title changed
Before · SP 800-73-4
GENERAL AUTHENTICATE Card Command
After · SP 800-73-5
GENERAL AUTHENTICATE Card Command
Control changed
Before · SP 800-73-4
The GENERAL AUTHENTICATE card command performs a cryptographic operation, such as an authentication protocol, using the data provided in the data field of the command and returns the result of the cryptographic operation in the response data field. 12
The GENERAL AUTHENTICATE command shall be used with the PIV authentication keys ('9A', '9B', '9E') to authenticate the card or a card application to the client application (INTERNAL AUTHENTICATE), to authenticate an entity to the card (EXTERNAL AUTHENTICATE), and to perform a mutual authentication between the card and an entity external to the card (MUTUAL AUTHENTICATE).
The GENERAL AUTHENTICATE command shall be used with the digital signature key ('9C') to realize the signing functionality on the PIV client application programming interface. Data to be signed is expected to be hashed off card. Appendix A.4 illustrates the use of the GENERAL AUTHENTICATE command for signature generation.
The GENERAL AUTHENTICATE command shall be used with the key management key ('9D') and the retired key management keys ('82' – '95') to realize key establishment schemes specified in SP 800-78 (ECDH and RSA). Appendix A.5 illustrates the use of the GENERAL AUTHENTICATE command for key establishment schemes aided by the PIV Card Application.
The GENERAL AUTHENTICATE command shall be used with the PIV Secure Messaging key ('04') and cryptographic algorithm identifier '27' or '2E' to establish session keys for secure messaging as specified in Section 4 . If key reference '04' is specified in P2, then algorithm identifiers in P1 other than '27' and '2E' shall not be permitted and the PIV Card Application shall return the status word '6A 86'.
The GENERAL AUTHENTICATE command supports command chaining to permit the uninterrupted transmission of long command data fields to the PIV Card Application. If a card command other than the GENERAL AUTHENTICATE command is received by the PIV Card Application before the termination of a GENERAL AUTHENTICATE chain, the PIV Card Application shall rollback to the state it was in immediately prior to the reception of the first command in the interrupted chain. In other words, an interrupted GENERAL AUTHENTICATE chain has no effect on the PIV Card Application.
12 For cryptographic operations with larger keys, e.g., RSA 2048, the GET RESPONSE command is used to return the complete result of the cryptographic operation. The GET RESPONSE command is illustrated in Appendix A.4.1 (Command 3). Command Syntax
CLA '00' or '10' indicating command chaining '0C' or '1C' for secure messaging INS '87' P1 Algorithm reference. See Table 14 and [SP800-78 , Table 6-2] P2 Key reference. See Table 4b, Part 1 for key reference values L c Length of data field Data Field See Table 7 L e Absent or '00'
Table 7. Data Objects in the Dynamic Authentication Template (Tag '7C')
Name Tag M/O Description Witness '80' C Demonstration of knowledge of a fact without revealing the fact. An empty witness is a request for a witness. Challenge '81' C One or more random numbers or byte sequences to be used in the authentication protocol. Response '82' C A sequence of bytes encoding a response step in an authentication protocol. Exponentiation '85' C A parameter used in ECDH key agreement protocol.
The data objects that appear in the dynamic authentication template (tag '7C') in the data field of the GENERAL AUTHENTICATE card command depend on the authentication protocol being executed. The Witness (tag '80') contains encrypted data (unrevealed fact). This data is decrypted by the card. The Challenge (tag '81') contains clear data (byte sequence), which is encrypted by the card. The Response (tag '82') contains either the decrypted data from tag '80' or the encrypted data from tag '81'. Note that the empty tags (i.e., tags with no data) return the same tag with content (they can be seen as “requests for requests”):
+ '80 00' Returns '80 TL <encrypted random>' (as per definition)
+ '81 00' Returns '81 TL <random>' (as per external authenticate example)
Data Field Absent, authentication-related data, signed data, shared secret, or transported key SW1-SW2 Status word
'61' 'xx' Successful execution where SW2 encodes the number of response data bytes still available '69' '82' Security status not satisfied '6A' '80' Incorrect parameter in command data field '6A' '86' Incorrect parameter in P1 or P2 3.3 PIV Card Application Card Commands for Credential Initialization and Administration
3.3.1 PUT DATA Card Command
The PUT DATA card command completely replaces the data content of a single data object in the PIV Card Application with new content.
Command Syntax
CLA '00' or '10' indicating command chaining INS 'DB' P1 '3F' P2 'FF' L c Length of data field Data Field See Tables 8 , 9 , and 10 L e Absent
For the 0x7E Discovery Object:
Table 8. Data Field of the PUT DATA Card Command for the Discovery Object
Tag M/O Description
'7E' M BER-TLV of tag '7E' as illustrated in Section 3.3.2, Part 1.
For the 0x7F61 BIT Group Template:
Table 9. Data Field of the PUT DATA Card Command for the BIT Group Template
Tag M/O Description
'7F61' M BER-TLV of tag '7F61' as illustrated in Table 7 of SP 800-76
For all other PIV Data objects:
Table 10. Data Field of the PUT DATA Card Command for all other PIV Data Objects
Name Tag M/O Description
Tag list '5C' M Tag of the data object whose data content is to be replaced. See Table 3, Part 1.
Data '53' M Data with tag '53' as an unstructured byte sequence.
Data Field Absent SW1-SW2 Status word '69' '82' Security status not satisfied '6A' '81' Function not supported '6A' '84' Not enough memory
3.3.2 GENERATE ASYMMETRIC KEY PAIR Card Command
The GENERATE ASYMMETRIC KEY PAIR card command initiates the generation and storing in the card of the reference data of an asymmetric key pair, i.e., a public key and a private key. The public key of the generated key pair is returned as the response to the command. If there is reference data currently associated with the key reference, it is replaced in full by the generated data.
Command Syntax
CLA '00' or '10' indicating command chaining INS '47' P1 '00' P2 Key reference '04', '9A', '9C', '9D', or '9E'. L c Length of data field Data Field Control reference template. See Table 11 L e '00'
Table 11. Data Objects in the Template (Tag 'AC')
Name Tag M/O Description Cryptographic mechanism identifier '80' M See Part 1, Table 5 Parameter '81' C Specific to the cryptographic mechanism
Data Field Data objects of public key of generated key pair. See Table 12 SW1-SW2 Status word
Table 12. Data Objects in the Template (Tag '7F49')
Name Tag Public key data objects for RSA Modulus '81' Public exponent '82'
Public key data objects for ECC Point '86' The public key data object in tag '86' is encoded as follows:
Table 13. Public Key encoding for ECC
Tag Length Value '86' L 04 || X || Y [SECG , Section 2.3.3]
Note: The octet '04' indicates that the X and Y coordinates of point P are encoded without the use of point compression. The length L is 65 bytes for points on Curve P-256 and 97 bytes for points on Curve P-384.
'61' 'xx' Successful execution where SW2 encodes the number of response data bytes still available '69' '82' Security status not satisfied
'6A' '80' Incorrect parameter in command data field; e.g., unrecognized cryptographic mechanism '6A' '81' Function not supported
'6A' '86' Incorrect parameter P2; cryptographic mechanism of reference data to be generated different than cryptographic mechanism of reference data of given key reference
After · SP 800-73-5
The GENERAL AUTHENTICATE card command performs a cryptographic operation, such as an authentication protocol, using the data provided in the data field of the command and returns the result of the cryptographic operation in the response data field. 12
The GENERAL AUTHENTICATE command shall be used with the PIV authentication keys ('9A', '9B', '9E') to authenticate the card or a card application to the client application (INTERNAL AUTHENTICATE), to authenticate an entity to the card (EXTERNAL AUTHENTICATE), and to perform a mutual authentication between the card and an entity external to the card (MUTUAL AUTHENTICATE).
The GENERAL AUTHENTICATE command shall be used with the digital signature key ('9C') to realize the signing functionality on the PIV client application programming interface. Data to be signed is expected to be hashed off card. Appendix A.4 illustrates the use of the GENERAL AUTHENTICATE command for signature generation.
The GENERAL AUTHENTICATE command shall be used with the key management key ('9D') and the retired key management keys ('82' – '95') to realize key establishment schemes specified in SP 800-78 (ECDH and RSA). Appendix A.5 illustrates the use of the GENERAL AUTHENTICATE command for key establishment schemes aided by the PIV Card Application.
The GENERAL AUTHENTICATE command shall be used with the PIV Secure Messaging key ('04') and cryptographic algorithm identifier '27' or '2E' to establish session keys for secure messaging as specified in Section 4 . If key reference '04' is specified in P2, then algorithm identifiers in P1 other than '27' and '2E' shall not be permitted and the PIV Card Application shall return the status word '6A 86'.
The GENERAL AUTHENTICATE command supports command chaining to permit the uninterrupted transmission of long command data fields to the PIV Card Application. If a card command other than the GENERAL AUTHENTICATE command is received by the PIV Card Application before the termination of a GENERAL AUTHENTICATE chain, the PIV Card Application shall rollback to the state it was in immediately prior to the reception of the first command in the interrupted chain. In other words, an interrupted GENERAL AUTHENTICATE chain has no effect on the PIV Card Application.
12 For cryptographic operations with larger keys, e.g., RSA 2048, the GET RESPONSE command is used to return the complete result of the cryptographic operation. The GET RESPONSE command is illustrated in Appendix A.4.1 (Command 3). Command Syntax
CLA '00' or '10' indicating command chaining '0C' or '1C' for secure messaging INS '87' P1 Algorithm reference. See Table 14 and [SP800-78 , Table 6-2] P2 Key reference. See Table 4b, Part 1 for key reference values L c Length of data field Data Field See Table 7 L e Absent or '00'
Table 7. Data Objects in the Dynamic Authentication Template (Tag '7C')
Name Tag M/O Description Witness '80' C Demonstration of knowledge of a fact without revealing the fact. An empty witness is a request for a witness. Challenge '81' C One or more random numbers or byte sequences to be used in the authentication protocol. Response '82' C A sequence of bytes encoding a response step in an authentication protocol. Exponentiation '85' C A parameter used in ECDH key agreement protocol.
The data objects that appear in the dynamic authentication template (tag '7C') in the data field of the GENERAL AUTHENTICATE card command depend on the authentication protocol being executed. The Witness (tag '80') contains encrypted data (unrevealed fact). This data is decrypted by the card. The Challenge (tag '81') contains clear data (byte sequence), which is encrypted by the card. The Response (tag '82') contains either the decrypted data from tag '80' or the encrypted data from tag '81'. Note that the empty tags (i.e., tags with no data) return the same tag with content (they can be seen as “requests for requests”):
+ '80 00' Returns '80 TL <encrypted random>' (as per definition)
+ '81 00' Returns '81 TL <random>' (as per external authenticate example)
Data Field Absent, authentication-related data, signed data, shared secret, or transported key SW1-SW2 Status word
'61' 'xx' Successful execution where SW2 encodes the number of response data bytes still available '69' '82' Security status not satisfied '6A' '80' Incorrect parameter in command data field '6A' '86' Incorrect parameter in P1 or P2 3.3 PIV Card Application Card Commands for Credential Initialization and Administration
3.3.1 PUT DATA Card Command
The PUT DATA card command completely replaces the data content of a single data object in the PIV Card Application with new content.
Command Syntax
CLA '00' or '10' indicating command chaining INS 'DB' P1 '3F' P2 'FF' L c Length of data field Data Field See Tables 8 , 9 , and 10 L e Absent
For the 0x7E Discovery Object:
Table 8. Data Field of the PUT DATA Card Command for the Discovery Object
Tag M/O Description
'7E' M BER-TLV of tag '7E' as illustrated in Section 3.3.2, Part 1.
For the 0x7F61 BIT Group Template:
Table 9. Data Field of the PUT DATA Card Command for the BIT Group Template
Tag M/O Description
'7F61' M BER-TLV of tag '7F61' as illustrated in Table 7 of SP 800-76
For all other PIV Data objects:
Table 10. Data Field of the PUT DATA Card Command for all other PIV Data Objects
Name Tag M/O Description
Tag list '5C' M Tag of the data object whose data content is to be replaced. See Table 3, Part 1.
Data '53' M Data with tag '53' as an unstructured byte sequence.
Data Field Absent SW1-SW2 Status word '69' '82' Security status not satisfied '6A' '81' Function not supported '6A' '84' Not enough memory
3.3.2 GENERATE ASYMMETRIC KEY PAIR Card Command
The GENERATE ASYMMETRIC KEY PAIR card command initiates the generation and storing in the card of the reference data of an asymmetric key pair, i.e., a public key and a private key. The public key of the generated key pair is returned as the response to the command. If there is reference data currently associated with the key reference, it is replaced in full by the generated data.
Command Syntax
CLA '00' or '10' indicating command chaining INS '47' P1 '00' P2 Key reference '04', '9A', '9C', '9D', or '9E'. L c Length of data field Data Field Control reference template. See Table 11 L e '00'
Table 11. Data Objects in the Template (Tag 'AC')
Name Tag M/O Description Cryptographic mechanism identifier '80' M See Part 1, Table 5 Parameter '81' C Specific to the cryptographic mechanism
Data Field Data objects of public key of generated key pair. See Table 12 SW1-SW2 Status word
Table 12. Data Objects in the Template (Tag '7F49')
Name Tag Public key data objects for RSA Modulus '81' Public exponent '82'
Public key data objects for ECC Point '86' The public key data object in tag '86' is encoded as follows:
Table 13. Public Key encoding for ECC
Tag Length Value '86' L 04 || X || Y [SECG , Section 2.3.3]
Note: The octet '04' indicates that the X and Y coordinates of point P are encoded without the use of point compression. The length L is 65 bytes for points on Curve P-256 and 97 bytes for points on Curve P-384.
'61' 'xx' Successful execution where SW2 encodes the number of response data bytes still available '69' '82' Security status not satisfied
'6A' '80' Incorrect parameter in command data field; e.g., unrecognized cryptographic mechanism '6A' '81' Function not supported
'6A' '86' Incorrect parameter P2; cryptographic mechanism of reference data to be generated different than cryptographic mechanism of reference data of given key reference