By including a
cnf (confirmation) claim in a CWT, the issuer of the CWT declares that the presenter possesses a particular key and that the recipient can cryptographically confirm that the presenter has possession of that key. The value of the
cnf claim is a CBOR map (which is defined in
Section 2.1 of
RFC 7049) and the members of that map identify the proof-of-possession key.
The presenter can be identified in one of several ways by the CWT, depending upon the application requirements. For instance, some applications may use the CWT
sub (subject) claim [
RFC 8392] to identify the presenter. Other applications may use the
iss (issuer) claim [
RFC 8392] to identify the presenter. In some applications, the subject identifier might be relative to the issuer identified by the
iss claim. The actual mechanism used is dependent upon the application. The case in which the presenter is the subject of the CWT is analogous to Security Assertion Markup Language (SAML) 2.0 [
OASIS.saml-core-2.0-os] SubjectConfirmation usage.
The
cnf claim in the CWT is used to carry confirmation methods. Some of them use proof-of-possession keys, while others do not. This design is analogous to the SAML 2.0 [
OASIS.saml-core-2.0-os] SubjectConfirmation element in which a number of different subject confirmation methods can be included (including proof-of-possession key information).
The set of confirmation members that a CWT must contain to be considered valid is context dependent and is outside the scope of this specification. Specific applications of CWTs will require implementations to understand and process some confirmation members in particular ways. However, in the absence of such requirements, all confirmation members that are not understood by implementations
MUST be ignored.
Section 7.2 establishes the IANA "CWT Confirmation Methods" registry for CWT
cnf member values and registers the members defined by this specification. Other specifications can register other members used for confirmation, including other members for conveying proof-of-possession keys using different key representations.
The
cnf claim value
MUST represent only a single proof-of-possession key. At most one of the
COSE_Key and
Encrypted_COSE_Key confirmation values defined in
Table 1 may be present. Note that if an application needs to represent multiple proof-of-possession keys in the same CWT, one way for it to achieve this is to use other claim names (in addition to
cnf) to hold the additional proof-of-possession key information. These claims could use the same syntax and semantics as the
cnf claim. Those claims would be defined by applications or other specifications and could be registered in the IANA "CBOR Web Token (CWT) Claims" registry [
IANA.CWT.Claims].
Name |
Key |
Value type |
COSE_Key |
1 |
COSE_Key |
Encrypted_COSE_Key |
2 |
COSE_Encrypt or COSE_Encrypt0 |
kid |
3 |
binary string |
Table 1: Summary of the cnf Names, Keys, and Value Types
When the key held by the presenter is an asymmetric private key, the
COSE_Key member is a COSE_Key [
RFC 8152] representing the corresponding asymmetric public key. The following example demonstrates such a declaration in the CWT Claims Set of a CWT:
{
/iss/ 1 : "coaps://server.example.com",
/aud/ 3 : "coaps://client.example.org",
/exp/ 4 : 1879067471,
/cnf/ 8 :{
/COSE_Key/ 1 :{
/kty/ 1 : /EC2/ 2,
/crv/ -1 : /P-256/ 1,
/x/ -2 : h'd7cc072de2205bdc1537a543d53c60a6acb62eccd890c7fa27c9
e354089bbe13',
/y/ -3 : h'f95e1d4b851a2cc80fff87d8e23f22afb725d535e515d020731e
79a3b4e47120'
}
}
}
The COSE_Key
MUST contain the required key members for a COSE_Key of that key type and
MAY contain other COSE_Key members, including the
kid (Key ID) member.
The
COSE_Key member
MAY also be used for a COSE_Key representing a symmetric key, provided that the CWT is encrypted so that the key is not revealed to unintended parties. The means of encrypting a CWT is explained in [
RFC 8392]. If the CWT is not encrypted, the symmetric key
MUST be encrypted as described in
Section 3.3. This procedure is equivalent to the one defined in
Section 3.3 of
RFC 7800.
When the key held by the presenter is a symmetric key, the
Encrypted_COSE_Key member is an encrypted COSE_Key [
RFC 8152] representing the symmetric key encrypted to a key known to the recipient using COSE_Encrypt or COSE_Encrypt0.
The following example illustrates a symmetric key that could subsequently be encrypted for use in the
Encrypted_COSE_Key member:
{
/kty/ 1 : /Symmetric/ 4,
/alg/ 3 : /HMAC 256-256/ 5,
/k/ -1 : h'6684523ab17337f173500e5728c628547cb37df
e68449c65f885d1b73b49eae1'
}
The COSE_Key representation is used as the plaintext when encrypting the key.
The following example CWT Claims Set of a CWT illustrates the use of an encrypted symmetric key as the
Encrypted_COSE_Key member value:
{
/iss/ 1 : "coaps://server.example.com",
/sub/ 2 : "24400320",
/aud/ 3: "s6BhdRkqt3",
/exp/ 4 : 1311281970,
/iat/ 5 : 1311280970,
/cnf/ 8 : {
/Encrypted_COSE_Key/ 2 : [
/protected header/ h'A1010A' /{ \alg\ 1:10 \AES-CCM-16-64-128\}/,
/unprotected header/ { / iv / 5: h'636898994FF0EC7BFCF6D3F95B'},
/ciphertext/ h'0573318A3573EB983E55A7C2F06CADD0796C9E584F1D0E3E
A8C5B052592A8B2694BE9654F0431F38D5BBC8049FA7F13F'
]
}
}
The example above was generated with the key:
h'6162630405060708090a0b0c0d0e0f10'
The proof-of-possession key can also be identified using a Key ID instead of communicating the actual key, provided the recipient is able to obtain the identified key using the Key ID. In this case, the issuer of a CWT declares that the presenter possesses a particular key and that the recipient can cryptographically confirm the presenter's proof of possession of the key by including a
cnf claim in the CWT whose value is a CBOR map containing a
kid member identifying the key.
The following example demonstrates such a declaration in the CWT Claims Set of a CWT:
{
/iss/ 1 : "coaps://as.example.com",
/aud/ 3 : "coaps://resource.example.org",
/exp/ 4 : 1361398824,
/cnf/ 8 : {
/kid/ 3 : h'dfd1aa976d8d4575a0fe34b96de2bfad'
}
}
The content of the
kid value is application specific. For instance, some applications may choose to use a cryptographic hash of the public key value as the
kid value.
Note that the use of a Key ID to identify a proof-of-possession key needs to be carefully circumscribed, as described below and in
Section 6. In cases where the Key ID is not a cryptographic value derived from the key or where not all of the parties involved are validating the cryptographic derivation, implementers should expect collisions where different keys are assigned the same Key ID. Recipients of a CWT with a PoP key linked through only a Key ID should be prepared to handle such situations.
In the world of constrained Internet of Things (IoT) devices, there is frequently a restriction on the size of Key IDs, either because of table constraints or a desire to keep message sizes small.
Note that the value of a Key ID for a specific key is not necessarily the same for different parties. When sending a COSE encrypted message with a shared key, the Key ID may be different on both sides of the conversation, with the appropriate one being included in the message based on the recipient of the message.
Proof of possession is often demonstrated by having the presenter sign a value determined by the recipient using the key possessed by the presenter. This value is sometimes called a "nonce" or a "challenge". There are, however, also other means to demonstrate freshness of the exchange and to link the proof-of-possession key to the participating parties, as demonstrated by various authentication and key exchange protocols.
The means of communicating the nonce and the nature of its contents are intentionally not described in this specification, as different protocols will communicate this information in different ways. Likewise, the means of communicating the signed nonce is also not specified, as this is also protocol specific.
Note that other means of proving possession of the key exist, which could be used in conjunction with a CWT's confirmation key. Applications making use of such alternate means are encouraged to register them in the IANA "CBOR Web Token (CWT) Confirmation Methods" registry established in
Section 7.2.