RFC 4556

Public Key Cryptography for Initial Authentication in Kerberos (PKINIT)

๐Ÿ“… published June 2006, from ietf

RFC 4556: Public Key Cryptography for Initial Authentication in Kerberos (PKINIT) ๐Ÿ’–

Network Working Group ยท Request for Comments: 4556 ยท Category: Standards Track ยท June 2006 ๐ŸŽ€

okay so the authors are L. Zhu from Microsoft Corporation and B. Tung from Aerospace Corporation ๐Ÿ‘ฉโ€๐Ÿ’ปโœจ it's a Standards Track doc dated June 2006, and the title block doesn't list anything it obsoletes or updates. no cap, that's the whole header situation ๐Ÿซถ

Status of This Memo โœจ

ok so this doc specifies an Internet standards track protocol for the Internet community, and it's literally asking for discussion and suggestions for improvements ๐Ÿ™ˆ if you want the current standardization state of this protocol, check the current edition of the "Internet Official Protocol Standards" (STD 1) ๐Ÿ“š and yes, distribution of this memo is unlimited ๐Ÿฆ‹

Copyright (C) The Internet Society (2006). ๐Ÿ’œ

Abstract ๐ŸŒธ

this doc describes protocol extensions (we're calling them PKINIT, obviously ๐Ÿ’…) to the Kerberos protocol spec. the vibe is that these extensions let you bring public key cryptography into the initial authentication exchange, using asymmetric-key signature and/or encryption algorithms inside pre-authentication data fields. main character energy for Kerberos ๐Ÿ‘‘

Table of Contents ๐Ÿงš

   1. Introduction ....................................................2
   2. Conventions Used in This Document ...............................4
   3. Extensions ......................................................5
      3.1. Definitions, Requirements, and Constants ...................6
           3.1.1. Required Algorithms .................................6
           3.1.2. Recommended Algorithms ..............................6
           3.1.3. Defined Message and Encryption Types ................7
           3.1.4. Kerberos Encryption Types Defined for CMS
                  Algorithm Identifiers ...............................8
      3.2. PKINIT Pre-authentication Syntax and Use ...................9
           3.2.1. Generation of Client Request ........................9
           3.2.2. Receipt of Client Request ..........................14
           3.2.3. Generation of KDC Reply ............................18
                  3.2.3.1. Using Diffie-Hellman Key Exchange .........21
                  3.2.3.2. Using Public Key Encryption ...............23

           3.2.4. Receipt of KDC Reply ...............................25
      3.3. Interoperability Requirements .............................26
      3.4. KDC Indication of PKINIT Support ..........................27
   4. Security Considerations ........................................27
   5. Acknowledgements ...............................................30
   6. References .....................................................30
      6.1. Normative References ......................................30
      6.2. Informative References ....................................32
   Appendix A.  PKINIT ASN.1 Module ..................................33
   Appendix B.  Test Vectors .........................................38
   Appendix C.  Miscellaneous Information about Microsoft Windows
                PKINIT Implementations ...............................40

1. Introduction โœจ

okay so the Kerberos V5 protocol [RFC4120] uses a trusted third party called the Key Distribution Center (KDC) to negotiate shared session keys between clients and services, and to provide mutual authentication between them ๐Ÿค

the corner-stones of Kerberos V5 are the Ticket and the Authenticator ๐ŸŽŸ๏ธ a Ticket wraps up a symmetric key (the ticket session key) in an envelope (a public message) meant for one specific service. the contents of the Ticket are encrypted with a symmetric key shared between the service principal and the issuing KDC, and the encrypted part of the Ticket contains the client principal name, among other items ๐Ÿ” an Authenticator is a record that can be shown to have been recently generated using the ticket session key in the associated Ticket. the ticket session key is known by the client who asked for the ticket, and the contents of the Authenticator are encrypted with that ticket session key. the encrypted part of an Authenticator has a timestamp and the client principal name, among other items ๐Ÿ•ฐ๏ธ

as shown in Figure 1, below, the Kerberos V5 protocol has the following message exchanges between the client and the KDC, and between the client and the application service ๐Ÿ—บ๏ธ

  • The Authentication Service (AS) Exchange ๐ŸŒท

the client gets an "initial" ticket from the Kerberos authentication server (AS), which is typically a Ticket Granting Ticket (TGT). the AS-REQ message and the AS-REP message are the request and the reply message, respectively, between the client and the AS.

  • The Ticket Granting Service (TGS) Exchange ๐ŸŽซ

the client then uses the TGT to authenticate and request a service ticket for a particular service, from the Kerberos ticket-granting server (TGS). the TGS-REQ message and the TGS-REP message are the request and the reply message respectively between the client and the TGS.

  • The Client/Server Authentication Protocol (AP) Exchange ๐Ÿ’Œ

the client then makes a request with an AP-REQ message, which has a service ticket and an authenticator that proves the client has the ticket session key. the server may optionally reply with an AP-REP message. AP exchanges typically negotiate session-specific symmetric keys ๐Ÿ”‘

usually the AS and TGS are integrated in a single device, which is also known as the KDC ๐Ÿข

                          +--------------+
               +--------->|  KDC         |
       AS-REQ /   +-------|              |
             /   /        +--------------+
            /   /          ^           |
           /    |AS-REP   /            |
          |     |        / TGS-REQ     + TGS-REP
          |     |       /             /
          |     |      /             /
          |     |     /   +---------+
          |     |    /   /
          |     |   /   /
          |     |  /   /
          |     v /   v
         ++-------+------+             +-----------------+
         |  Client       +------------>|  Application    |
         |               |    AP-REQ   |  Server         |
         |               |<------------|                 |
         +---------------+    AP-REP   +-----------------+

Figure 1: The Message Exchanges in the Kerberos V5 Protocol ๐Ÿ–ผ๏ธ

in the AS exchange, the KDC reply carries the ticket session key (among other items), and it's encrypted using a key called the AS reply key, which is shared between the client and the KDC ๐Ÿ”’ the AS reply key is typically derived from the client's password for human users. so for human users, the attack resistance strength of Kerberos is no stronger than the strength of their passwords ๐Ÿ˜ญ๐Ÿ’€

the use of asymmetric cryptography in the form of X.509 certificates [RFC3280] is popular for data origin authentication and perfect secrecy ๐Ÿฆ‹ an established Public Key Infrastructure (PKI) gives you key management and key distribution mechanisms that can be used to set up authentication and secure communication. adding public-key cryptography to Kerberos gives a nice congruence with public-key protocols, takes the burden of managing strong passwords off human users, and lets Kerberized applications use existing key services and identity management โœจ

the advantage of the Kerberos TGT is that the client exposes their long-term secrets only once. the TGT and its associated session key can then be used for any later service ticket requests. one result is that all further authentication is independent of the method used for the initial authentication. so initial authentication is a convenient place to plug public-key cryptography into Kerberos. also, symmetric cryptography after the initial exchange is preferred for performance ๐ŸŽ๏ธ

this document describes the methods and data formats that let the client and the KDC use public and private key pairs to mutually authenticate in the AS exchange, and to negotiate the AS reply key (known only by the client and the KDC) that encrypts the AS-REP sent by the KDC ๐Ÿซถ

2. Conventions Used in This Document ๐Ÿ“

the key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC2119]. these are the official BCP 14 key words, so read them carefully ๐Ÿง

in this protocol, both the client and the KDC have a public-private key pair so they can prove who they are to each other over the open network. the term "signature key" refers to the private key of the key pair being used ๐Ÿ–Š๏ธ

the encryption key used to encrypt the enc-part field of the KDC-REP in the AS-REP [RFC4120] is called the AS reply key ๐Ÿ”‘

an empty sequence in an optional field can be either included or omitted. both encodings are permitted and count as equivalent ๐ŸŒธ

the term "Modular Exponential Diffie-Hellman" refers to the Diffie-Hellman key exchange described in [RFC2631]. it's used to tell it apart from other equivalent ways of writing the same key agreement algorithm ๐Ÿงฎ

3. Extensions ๐ŸŽ€

this section describes extensions to [RFC4120] that support using public-key cryptography in the initial request for a ticket ๐Ÿ’œ

briefly, this document defines the following extensions to [RFC4120]:

  1. The client indicates the use of public-key authentication by including a special preauthenticator in the initial request. this preauthenticator has the client's public-key data and a signature ๐Ÿ–‹๏ธ
  2. The KDC tests the client's request against its authentication policy and trusted Certification Authorities (CAs) ๐Ÿ›‚
  3. If the request passes the verification tests, the KDC replies as usual, but the reply is encrypted using either:

a. a key generated through a Diffie-Hellman (DH) key exchange [RFC2631] [IEEE1363] with the client, signed using the KDC's signature key; or

b. a symmetric encryption key, signed using the KDC's signature key and encrypted using the client's public key.

any keying material the client needs to get the encryption key for decrypting the KDC reply is returned in a pre-authentication field that comes along with the usual reply ๐Ÿ“ฆ

  1. The client validates the KDC's signature, gets the encryption key, decrypts the reply, and then carries on as usual ๐Ÿฅณ

Section 3.1 of this document lists the required algorithms and the necessary extension message types. Section 3.2 goes into the extension messages in more detail ๐Ÿ”

3.1. Definitions, Requirements, and Constants ๐Ÿ“š

3.1.1. Required Algorithms ๐Ÿงฉ

All PKINIT implementations MUST support the following algorithms:

  • AS reply key enctypes: aes128-cts-hmac-sha1-96 and aes256-cts-hmac-sha1-96 [RFC3962].
  • Signature algorithm: sha-1WithRSAEncryption [RFC3370].
  • AS reply key delivery method: the Diffie-Hellman key delivery method, as described in Section 3.2.3.1.

in addition, implementations of this specification MUST be capable of processing the Extended Key Usage (EKU) extension and the id-pkinit-san (as defined in Section 3.2.2) otherName of the Subject Alternative Name (SAN) extension in X.509 certificates [RFC3280] ๐ŸŒˆโœจ

okay bestie, every PKINIT implementation SHOULD support this one โœจ

  • AS reply key delivery method: the public key encryption key delivery method, as described in Section 3.2.3.2. ๐Ÿ”‘

if your implementation supports the public key encryption key delivery method, then these algorithms MUST be supported ๐Ÿ’…

  • a) Key transport algorithms identified in the keyEncryptionAlgorithm field of the type KeyTransRecipientInfo [RFC3852] for encrypting the temporary key in the encryptedKey field [RFC3852] with a public key, as described in Section 3.2.3.2: rsaEncryption (this is the RSAES-PKCS1-v1_5 encryption scheme) [RFC3370] [RFC3447].
  • b) Content encryption algorithms identified in the contentEncryptionAlgorithm field of the type EncryptedContentInfo [RFC3852] for encrypting the AS reply key with the temporary key contained in the encryptedKey field of the type KeyTransRecipientInfo [RFC3852], as described in Section 3.2.3.2: des-ede3-cbc (three-key 3DES, CBC mode) [RFC3370].

3.1.3. Defined Message and Encryption Types โœจ

PKINIT makes use of the following new pre-authentication types ๐ŸŽ€

    PA_PK_AS_REQ                                 16
    PA_PK_AS_REP                                 17

PKINIT also makes use of the following new authorization data type ๐Ÿฆ‹

    AD_INITIAL_VERIFIED_CAS                       9

PKINIT introduces the following new error codes ๐Ÿ˜ญ

    KDC_ERR_CLIENT_NOT_TRUSTED                   62
    KDC_ERR_INVALID_SIG                          64
    KDC_ERR_DH_KEY_PARAMETERS_NOT_ACCEPTED       65
    KDC_ERR_CANT_VERIFY_CERTIFICATE              70
    KDC_ERR_INVALID_CERTIFICATE                  71
    KDC_ERR_REVOKED_CERTIFICATE                  72
    KDC_ERR_REVOCATION_STATUS_UNKNOWN            73
    KDC_ERR_CLIENT_NAME_MISMATCH                 75
    KDC_ERR_INCONSISTENT_KEY_PURPOSE             77
    KDC_ERR_DIGEST_IN_CERT_NOT_ACCEPTED          78
    KDC_ERR_PA_CHECKSUM_MUST_BE_INCLUDED         79
    KDC_ERR_DIGEST_IN_SIGNED_DATA_NOT_ACCEPTED   80
    KDC_ERR_PUBLIC_KEY_ENCRYPTION_NOT_SUPPORTED  81

PKINIT uses the following typed data types for errors ๐ŸŒธ

    TD_TRUSTED_CERTIFIERS                       104
    TD_INVALID_CERTIFICATES                     105
    TD_DH_PARAMETERS                            109

The ASN.1 module for all structures defined in this document (plus IMPORT statements for all imported structures) is given in Appendix A. ๐Ÿ“œ

All structures defined in or imported into this document MUST be encoded using Distinguished Encoding Rules (DER) [X680] [X690] (unless otherwise noted). All data structures carried in OCTET STRINGs MUST be encoded according to the rules specified in the specifications defining each data structure; a reference to the appropriate specification is provided for each data structure. ๐Ÿซถ

Interoperability note: Some implementations may not be able to decode wrapped Cryptographic Message Syntax (CMS) [RFC3852] objects encoded with BER; specifically, they may not be able to decode indefinite-length encodings. To maximize interoperability, implementers SHOULD encode CMS objects used in PKINIT with DER. ๐Ÿงš

3.1.4. Kerberos Encryption Types Defined for CMS Algorithm Identifiers ๐ŸŒˆ

PKINIT defines the following Kerberos encryption type numbers [RFC3961], which can be used in the etype field of the AS-REQ [RFC4120] message to indicate to the KDC the client's acceptance of the corresponding algorithms (including key transport algorithms [RFC3370], content encryption algorithms [RFC3370], and signature algorithms) for use with Cryptographic Message Syntax (CMS) [RFC3852] [RFC3370].

Per [RFC4120], the encryption types in the etype field are in the decreasing preference order of the client. Note that there is no significance in the relative order between any two of different types of algorithms: key transport algorithms, content encryption algorithms, and signature algorithms. ๐Ÿ‘‘

The presence of each of these encryption types in the etype field is equivalent to the presence of the corresponding algorithm Object Identifier (OID) in the supportedCMSTypes field as described in Section 3.2.1. And the preference order expressed in the supportedCMSTypes field would override the preference order listed in the etype field. ๐Ÿ“

 Kerberos Encryption Type Name  Num  Corresponding Algorithm OID
 ============================== === ===============================
 id-dsa-with-sha1-CmsOID         9  id-dsa-with-sha1 [RFC3370]
 md5WithRSAEncryption-CmsOID    10  md5WithRSAEncryption [RFC3370]
 sha-1WithRSAEncryption-CmsOID  11  sha-1WithRSAEncryption [RFC3370]
 rc2-cbc-EnvOID                 12  rc2-cbc [RFC3370]
 rsaEncryption-EnvOID           13  rsaEncryption [RFC3447][RFC3370]
 id-RSAES-OAEP-EnvOID           14  id-RSAES-OAEP [RFC3447][RFC3560]
 des-ede3-cbc-EnvOID            15  des-ede3-cbc [RFC3370]

The above encryption type numbers are used only to indicate support for the use of the corresponding algorithms in PKINIT; they do not correspond to actual Kerberos encryption types [RFC3961] and MUST NOT be used in the etype field of the Kerberos EncryptedData type [RFC4120]. The practice of assigning Kerberos encryption type numbers to indicate support for CMS algorithms is considered deprecated, and new numbers should not be assigned for this purpose. Instead, the supportedCMSTypes field should be used to identify the algorithms supported by the client and the preference order of the client. ๐Ÿ™ˆ

For maximum interoperability, however, PKINIT clients wishing to indicate to the KDC the support for one or more of the algorithms listed above SHOULD include the corresponding encryption type number(s) in the etype field of the AS-REQ. ๐Ÿ’œ


3.2. PKINIT Pre-authentication Syntax and Use ๐Ÿฆ‹

This section defines the syntax and use of the various pre-authentication fields employed by PKINIT. โœจ

3.2.1. Generation of Client Request ๐Ÿ’…

The initial authentication request (AS-REQ) is sent as per [RFC4120]; in addition, a pre-authentication data element, whose padata-type is PA_PK_AS_REQ and whose padata-value contains the DER encoding of the type PA-PK-AS-REQ, is included. ๐ŸŽ€

    PA-PK-AS-REQ ::= SEQUENCE {
       signedAuthPack          [0] IMPLICIT OCTET STRING,
                -- Contains a CMS type ContentInfo encoded
                -- according to [RFC3852].
                -- The contentType field of the type ContentInfo
                -- is id-signedData (1.2.840.113549.1.7.2),
                -- and the content field is a SignedData.
                -- The eContentType field for the type SignedData is
                -- id-pkinit-authData (1.3.6.1.5.2.3.1), and the
                -- eContent field contains the DER encoding of the
                -- type AuthPack.
                -- AuthPack is defined below.
       trustedCertifiers       [1] SEQUENCE OF
                   ExternalPrincipalIdentifier OPTIONAL,
                -- Contains a list of CAs, trusted by the client,
                -- that can be used to certify the KDC.
                -- Each ExternalPrincipalIdentifier identifies a CA
                -- or a CA certificate (thereby its public key).
                -- The information contained in the
                -- trustedCertifiers SHOULD be used by the KDC as
                -- hints to guide its selection of an appropriate
                -- certificate chain to return to the client.
       kdcPkId                 [2] IMPLICIT OCTET STRING
                                   OPTIONAL,
                -- Contains a CMS type SignerIdentifier encoded
                -- according to [RFC3852].
                -- Identifies, if present, a particular KDC
                -- public key that the client already has.
       ...
    }

    DHNonce ::= OCTET STRING

    ExternalPrincipalIdentifier ::= SEQUENCE {
       subjectName            [0] IMPLICIT OCTET STRING OPTIONAL,
                -- Contains a PKIX type Name encoded according to
                -- [RFC3280].
                -- Identifies the certificate subject by the
                -- distinguished subject name.
                -- REQUIRED when there is a distinguished subject
                -- name present in the certificate.
      issuerAndSerialNumber   [1] IMPLICIT OCTET STRING OPTIONAL,
                -- Contains a CMS type IssuerAndSerialNumber encoded
                -- according to [RFC3852].
                -- Identifies a certificate of the subject.
                -- REQUIRED for TD-INVALID-CERTIFICATES and
                -- TD-TRUSTED-CERTIFIERS.
      subjectKeyIdentifier    [2] IMPLICIT OCTET STRING OPTIONAL,
                -- Identifies the subject's public key by a key
                -- identifier.  When an X.509 certificate is
                -- referenced, this key identifier matches the X.509
                -- subjectKeyIdentifier extension value.  When other
                -- certificate formats are referenced, the documents
                -- that specify the certificate format and their use
                -- with the CMS must include details on matching the
                -- key identifier to the appropriate certificate
                -- field.
                -- RECOMMENDED for TD-TRUSTED-CERTIFIERS.
       ...
    }

    AuthPack ::= SEQUENCE {
       pkAuthenticator         [0] PKAuthenticator,
       clientPublicValue       [1] SubjectPublicKeyInfo OPTIONAL,
                -- Type SubjectPublicKeyInfo is defined in
                -- [RFC3280].
                -- Specifies Diffie-Hellman domain parameters
                -- and the client's public key value [IEEE1363].

                -- The DH public key value is encoded as a BIT
                -- STRING according to [RFC3279].
                -- This field is present only if the client wishes
                -- to use the Diffie-Hellman key agreement method.
       supportedCMSTypes       [2] SEQUENCE OF AlgorithmIdentifier
                                   OPTIONAL,
                -- Type AlgorithmIdentifier is defined in
                -- [RFC3280].
                -- List of CMS algorithm [RFC3370] identifiers
                -- that identify key transport algorithms, or
                -- content encryption algorithms, or signature
                -- algorithms supported by the client in order of
                -- (decreasing) preference.
       clientDHNonce           [3] DHNonce OPTIONAL,
                -- Present only if the client indicates that it
                -- wishes to reuse DH keys or to allow the KDC to
                -- do so (see Section 3.2.3.1).
       ...
    }

    PKAuthenticator ::= SEQUENCE {
       cusec                   [0] INTEGER (0..999999),
       ctime                   [1] KerberosTime,
                -- cusec and ctime are used as in [RFC4120], for
                -- replay prevention.
       nonce                   [2] INTEGER (0..4294967295),
                -- Chosen randomly;  this nonce does not need to
                -- match with the nonce in the KDC-REQ-BODY.
       paChecksum              [3] OCTET STRING OPTIONAL,
                -- MUST be present.
                -- Contains the SHA1 checksum, performed over
                -- KDC-REQ-BODY.
       ...
    }

Okay so the ContentInfo [RFC3852] structure sitting in the signedAuthPack field of PA-PK-AS-REQ gets encoded according to [RFC3852], and it's filled out like this ๐ŸŽ€

  1. The contentType field of ContentInfo is id-signedData (as defined in [RFC3852]), and the content field is a SignedData (as defined in [RFC3852]). ๐Ÿ’–
  2. The eContentType field for SignedData is id-pkinit-authData: { iso(1) org(3) dod(6) internet(1) security(5) kerberosv5(2) pkinit(3) authData(1) }. Notes for the CMS implementers: the signed attribute content-type MUST be present in this SignedData instance, and its value is id-pkinit-authData according to [RFC3852]. โœจ
  3. The eContent field for SignedData holds the DER encoding of the AuthPack type. ๐Ÿงš
  4. The signerInfos field of SignedData contains a single signerInfo, and that signerInfo holds the signature over the AuthPack type. ๐Ÿ”ฅ
  5. The AuthPack structure is the main event ๐Ÿ‘‘: it contains a PKAuthenticator, the client public key information, the CMS encryption types the client supports, and a DHNonce. The pkAuthenticator field is how the client proves to the KDC that it has recent knowledge of the signing key that authenticates the client. ๐Ÿซถ The clientPublicValue field specifies the Diffie-Hellman domain parameters and the client's public key value. The DH public key value is encoded as a BIT STRING according to [RFC3279]. The clientPublicValue field is present only if the client wishes to use the Diffie-Hellman key agreement method. ๐Ÿฆ‹ The supportedCMSTypes field lists the CMS algorithm identifiers the client supports, in order of (decreasing) preference. These can identify a signature algorithm or a key transport algorithm [RFC3370] in the keyEncryptionAlgorithm field of KeyTransRecipientInfo, or a content encryption algorithm [RFC3370] in the contentEncryptionAlgorithm field of EncryptedContentInfo [RFC3852] when encrypting the AS reply key as described in Section 3.2.3.2. However, there is no significance in the relative order between any two algorithms of different types: key transport algorithms, content encryption algorithms, and signature algorithms. ๐ŸŒˆ The clientDHNonce field is described later in this section.
  6. The ctime field in the PKAuthenticator structure holds the current time on the client's host, and the cusec field holds the microsecond part of the client's timestamp. ctime and cusec are used together to specify a reasonably accurate timestamp [RFC4120]. โฐ The nonce field is chosen randomly. The paChecksum field MUST be present, and it contains a SHA1 checksum that is performed over the KDC-REQ-BODY [RFC4120]. ๐Ÿ™ˆ To ease a future migration away from SHA1, the paChecksum field is made optional syntactically: when the request is extended to negotiate hash algorithms, a new client that doesn't want to use SHA1 will send the request in the extended message syntax without the paChecksum field. The KDC conforming to this specification MUST return a KRB-ERROR [RFC4120] message with the code KDC_ERR_PA_CHECKSUM_MUST_BE_INCLUDED (see Section 3.2.3). That lets a new client retry with SHA1 if the local policy allows it. ๐Ÿ’…
  7. The certificates field of SignedData contains certificates meant to help with certification path construction, so the KDC can verify the signature over the AuthPack type. For path validation, these certificates SHOULD be sufficient to construct at least one certification path from the client certificate to one trust anchor acceptable to the KDC [RFC4158]. The client MUST be capable of including such a set of certificates if configured to do so. The certificates field MUST NOT contain "root" CA certificates. ๐Ÿ“
  8. The client's Diffie-Hellman public value (clientPublicValue) is included if and only if the client wishes to use the Diffie-Hellman key agreement method. The Diffie-Hellman domain parameters [IEEE1363] for the client's public key are specified in the algorithm field of SubjectPublicKeyInfo [RFC3279], and the client's Diffie-Hellman public key value is mapped to a subjectPublicKey (a BIT STRING) according to [RFC3279]. When using the Diffie-Hellman key agreement method, implementations MUST support Oakley 1024-bit Modular Exponential (MODP) well-known group 2 [RFC2412] and Oakley 2048-bit MODP well-known group 14 [RFC3526], and SHOULD support Oakley 4096-bit MODP well-known group 16 [RFC3526].

The Diffie-Hellman field size should be chosen so as to provide sufficient cryptographic security [RFC3766]. ๐Ÿ”

When MODP Diffie-Hellman is used, the exponents should have at least twice as many bits as the symmetric keys that will be derived from them [ODL99]. ๐Ÿง 

  1. The client may wish to reuse DH keys, or to allow the KDC to do so (see Section 3.2.3.1). If so, the client includes the clientDHNonce field. This nonce string MUST be as long as the longest key length of the symmetric key types that the client supports. This nonce MUST be chosen randomly. ๐ŸŽฒ

The ExternalPrincipalIdentifier structure is used in this document to identify the subject's public key, and therefore the subject principal. ๐Ÿชช It's filled out like this:

  1. The subjectName field contains a PKIX type Name encoded according to [RFC3280]. It identifies the certificate subject by the distinguished subject name. This field is REQUIRED when there is a distinguished subject name present in the certificate being used. ๐Ÿ“›
  2. The issuerAndSerialNumber field contains a CMS type IssuerAndSerialNumber encoded according to [RFC3852]. It identifies a certificate of the subject. This field is REQUIRED for TD-INVALID-CERTIFICATES and TD-TRUSTED-CERTIFIERS (both structures are defined in Section 3.2.2). ๐Ÿ“œ
  3. The subjectKeyIdentifier [RFC3852] field identifies the subject's public key by a key identifier. When an X.509 certificate is referenced, this key identifier matches the X.509 subjectKeyIdentifier extension value. When other certificate formats are referenced, the documents that specify that certificate format and its use with CMS must include details on matching the key identifier to the appropriate certificate field. This field is RECOMMENDED for TD-TRUSTED-CERTIFIERS (as defined in Section 3.2.2). ๐Ÿ—๏ธ

The trustedCertifiers field of PA-PK-AS-REQ contains a list of CAs, trusted by the client, that can be used to certify the KDC. Each ExternalPrincipalIdentifier identifies a CA or a CA certificate (and therefore its public key). ๐Ÿ›๏ธ

The kdcPkId field of PA-PK-AS-REQ contains a CMS type SignerIdentifier encoded according to [RFC3852]. If present, this field identifies a particular KDC public key that the client already has. ๐ŸŒธ

3.2.2. Receipt of Client Request ๐Ÿ“จ

okay bestie, so when the KDC gets the client's request, it has to validate it before doing anything else ๐Ÿซถ this section lists the steps the KDC MUST take (unless it says otherwise) to check the request โœจ

The KDC checks the client's signature in the signedAuthPack field according to [RFC3852] ๐Ÿ”

If the KDC tries to validate the client's X.509 certificate [RFC3280] and can't build a certification path to check it, it sends back a KRB-ERROR [RFC4120] message with the code KDC_ERR_CANT_VERIFY_CERTIFICATE ๐Ÿ™ˆ the e-data for this error is a TYPED-DATA (as defined in [RFC4120]). It holds an element whose data-type is TD_TRUSTED_CERTIFIERS, and its data-value is the DER encoding of the type TD-TRUSTED-CERTIFIERS:

       TD-TRUSTED-CERTIFIERS ::= SEQUENCE OF
                      ExternalPrincipalIdentifier
                   -- Identifies a list of CAs trusted by the KDC.
                   -- Each ExternalPrincipalIdentifier identifies a CA
                   -- or a CA certificate (thereby its public key).

Each ExternalPrincipalIdentifier (as defined in Section 3.2.1) in the TD-TRUSTED-CERTIFIERS structure identifies a CA or a CA certificate (thereby its public key) that the KDC trusts ๐Ÿ’–

When the client gets this error, it SHOULD only retry if it has a different set of certificates (compared to the previous requests) that forms a certification path, or a partial path, from one of the trust anchors the KDC accepts to its own certificate ๐Ÿฆ‹

If the KDC is processing the certification path and finds that the signature on one of the certificates in the signedAuthPack field is invalid, it returns a KRB-ERROR [RFC4120] message with the code KDC_ERR_INVALID_CERTIFICATE ๐Ÿ˜ญ the e-data for this one is a TYPED-DATA with an element whose data-type is TD_INVALID_CERTIFICATES, and whose data-value is the DER encoding of the type TD-INVALID-CERTIFICATES:

       TD-INVALID-CERTIFICATES ::= SEQUENCE OF
                      ExternalPrincipalIdentifier
                   -- Each ExternalPrincipalIdentifier identifies a
                   -- certificate (sent by the client) with an invalid
                   -- signature.

Each ExternalPrincipalIdentifier (as defined in Section 3.2.1) in the TD-INVALID-CERTIFICATES structure identifies a certificate (that the client sent) with an invalid signature ๐ŸŒธ

If more than one X.509 certificate signature is invalid, the KDC MAY include one IssuerAndSerialNumber per invalid signature inside the TD-INVALID-CERTIFICATES ๐Ÿงš

The client's X.509 certificate gets validated according to [RFC3280] ๐Ÿ“œ

Depending on local policy, the KDC may also check whether any X.509 certificates in the certification path that validates the client's certificate have been revoked. If any of them have been revoked, the KDC MUST return an error message with the code KDC_ERR_REVOKED_CERTIFICATE. If the KDC tries to figure out the revocation status but can't, it SHOULD return an error message with the code KDC_ERR_REVOCATION_STATUS_UNKNOWN ๐Ÿ’€ the affected certificate or certificates get identified exactly the same way as for KDC_ERR_INVALID_CERTIFICATE (see above) ๐ŸŽ€

Note that the TD_INVALID_CERTIFICATES error data is only used to identify invalid certificates that the client sent in the request ๐Ÿ‘‘

Next, the client's public key is used to verify the signature. If the signature doesn't verify, the KDC MUST return an error message with the code KDC_ERR_INVALID_SIG. There is no accompanying e-data for this error message ๐Ÿ™…โ€โ™€๏ธ

On top of validating the client's signature, the KDC MUST also check that the client's public key (the one used to verify that signature) is bound to the client principal name in the AS-REQ. It does this in the following order:

  1. If the KDC has its own binding between either the client's signature-verification public key or the client's certificate and the client's Kerberos principal name, it uses that binding. ๐Ÿ”—
  2. Otherwise, if the client's X.509 certificate has a Subject Alternative Name (SAN) extension carrying a KRB5PrincipalName (defined below) in the otherName field of the type GeneralName [RFC3280], it binds the client's X.509 certificate to that name. โœจ

The type of the otherName field is AnotherName. The type-id field of the type AnotherName is id-pkinit-san:

        id-pkinit-san OBJECT IDENTIFIER ::=
         { iso(1) org(3) dod(6) internet(1) security(5) kerberosv5(2)
           x509SanAN (2) }

And the value field of the type AnotherName is a KRB5PrincipalName.

       KRB5PrincipalName ::= SEQUENCE {
           realm                   [0] Realm,
           principalName           [1] PrincipalName
       }

If the Kerberos client name in the AS-REQ doesn't match a name the KDC has bound (the binding can live in the certificate, like we just described), or if the KDC finds no binding at all, the KDC MUST return an error message with the code KDC_ERR_CLIENT_NAME_MISMATCH. There is no accompanying e-data for this error message ๐Ÿ˜ญ

Even when the certification path is validated and the certificate maps to the client's principal name, the KDC may still decide not to accept the client's certificate, depending on local policy ๐Ÿ™ˆ

The KDC MAY require the presence of an Extended Key Usage (EKU) KeyPurposeId [RFC3280] id-pkinit-KPClientAuth in the extensions field of the client's X.509 certificate:

        id-pkinit-KPClientAuth OBJECT IDENTIFIER ::=
         { iso(1) org(3) dod(6) internet(1) security(5) kerberosv5(2)
           pkinit(3) keyPurposeClientAuth(4) }
              -- PKINIT client authentication.
              -- Key usage bits that MUST be consistent:
              -- digitalSignature.

The digitalSignature key usage bit [RFC3280] MUST be asserted when the intended purpose of the client's X.509 certificate is restricted with the id-pkinit-KPClientAuth EKU ๐Ÿ”ฅ

If this EKU KeyPurposeId is required but isn't there, or if the client certificate is restricted from being used for PKINIT client authentication per Section 4.2.1.13 of [RFC3280], the KDC MUST return an error message with the code KDC_ERR_INCONSISTENT_KEY_PURPOSE. There is no accompanying e-data for this error message. KDCs that implement this requirement SHOULD also accept the EKU KeyPurposeId id-ms-kp-sc-logon (1.3.6.1.4.1.311.20.2.2) as meeting the requirement, because a huge number of X.509 client certificates already deployed for PKINIT have this EKU ๐ŸŒˆ

As a matter of local policy, the KDC MAY decide to reject requests based on the absence or presence of other specific EKU OIDs ๐Ÿ“

If the digest algorithm used in generating the CA signature for the public key in any certificate of the request isn't acceptable to the KDC, the KDC MUST return a KRB-ERROR [RFC4120] message with the code KDC_ERR_DIGEST_IN_CERT_NOT_ACCEPTED. The accompanying e-data MUST be encoded in TYPED-DATA, although none is defined at this point ๐Ÿ’…

If the client's public key isn't accepted for reasons other than the ones above, the KDC returns a KRB-ERROR [RFC4120] message with the code KDC_ERR_CLIENT_NOT_TRUSTED. There is no e-data currently defined for this error message ๐Ÿฆ‹

The KDC MUST check the timestamp to make sure the request isn't a replay and that the time skew is within acceptable limits. The recommendations for clock skew times in [RFC4120] apply here โฐ If the check fails, the KDC MUST return error code KRB_AP_ERR_REPEAT or KRB_AP_ERR_SKEW, respectively.

If the clientPublicValue is filled in, which means the client wants to use the Diffie-Hellman key agreement method, the KDC SHOULD check whether the key parameters satisfy its policy. If they don't, it MUST return an error message with the code KDC_ERR_DH_KEY_PARAMETERS_NOT_ACCEPTED. The accompanying e-data is a TYPED-DATA with an element whose data-type is TD_DH_PARAMETERS, and whose data-value is the DER encoding of the type TD-DH-PARAMETERS:

       TD-DH-PARAMETERS ::= SEQUENCE OF AlgorithmIdentifier
                   -- Each AlgorithmIdentifier specifies a set of
                   -- Diffie-Hellman domain parameters [IEEE1363].
                   -- This list is in decreasing preference order.

TD-DH-PARAMETERS contains a list of the Diffie-Hellman domain parameters that the KDC supports, in decreasing preference order. The client SHOULD pick one from that list to retry the request ๐Ÿซถ

The AlgorithmIdentifier structure is defined in [RFC3280] and gets filled in according to [RFC3279]. More specifically, Section 2.3.3 of [RFC3279] describes how to fill in the AlgorithmIdentifier structure when MODP Diffie-Hellman key exchange is used ๐Ÿงช

If the client included a kdcPkId field in the PA-PK-AS-REQ and the KDC doesn't have the corresponding key, the KDC MUST ignore the kdcPkId field as if the client hadn't included one ๐Ÿ™ˆ

If the digest algorithm used by the id-pkinit-authData isn't acceptable to the KDC, the KDC MUST return a KRB-ERROR [RFC4120] message with the code KDC_ERR_DIGEST_IN_SIGNED_DATA_NOT_ACCEPTED. The accompanying e-data MUST be encoded in TYPED-DATA, although none is defined at this point โœจ

3.2.3. Generation of KDC Reply โœจ

okay so if the paChecksum field isn't in the request, the KDC conforming to this spec MUST return a KRB-ERROR [RFC4120] message with the code KDC_ERR_PA_CHECKSUM_MUST_BE_INCLUDED ๐Ÿ™ˆ. The e-data on that error MUST be encoded in TYPED-DATA (this spec doesn't define any other error data, so that's the only option bestie ๐Ÿ’…).

If the client's request has been properly validated, the KDC keeps going as per [RFC4120], with a few upgrades listed below ๐Ÿซถ

The KDC MUST set the initial flag and include an authorization data element of ad-type [RFC4120] AD_INITIAL_VERIFIED_CAS in the issued ticket ๐ŸŽ€ The ad-data [RFC4120] field holds the DER encoding of the type AD-INITIAL-VERIFIED-CAS:

    AD-INITIAL-VERIFIED-CAS ::= SEQUENCE OF
                   ExternalPrincipalIdentifier
                -- Identifies the certification path with which
                -- the client certificate was validated.
                -- Each ExternalPrincipalIdentifier identifies a CA
                -- or a CA certificate (thereby its public key).

The AD-INITIAL-VERIFIED-CAS structure tells you which certification path the client certificate was validated with ๐Ÿ”ฅ Each ExternalPrincipalIdentifier (as defined in Section 3.2.1) inside it identifies a CA or a CA certificate, which means its public key too ๐Ÿฆ‹

Heads up, the AD-INITIAL-VERIFIED-CAS syntax does allow empty SEQUENCEs to be encoded ๐Ÿ‘€ Empty sequences may only be used if the KDC itself vouches for the user's certificate. Not me being dramatic, that's just the rule ๐Ÿ’€

The AS wraps any AD-INITIAL-VERIFIED-CAS data in AD-IF-RELEVANT containers if the list of CAs satisfies the AS' realm's local policy (this lines up with the TRANSITED-POLICY-CHECKED ticket flag [RFC4120]) ๐ŸŒธ Also, any TGS MUST copy that authorization data from tickets used within a PA-TGS-REQ of the TGS-REQ into the resulting ticket ๐Ÿซถ If the list of CAs satisfies the local KDC's realm's policy, the TGS MAY wrap the data into the AD-IF-RELEVANT container. Otherwise, it MAY unwrap the authorization data out of the AD-IF-RELEVANT container ๐Ÿงš

Application servers that understand this authorization data type SHOULD apply local policy to decide whether a ticket carrying that type, not inside an AD-IF-RELEVANT container, is acceptable ๐Ÿ™ˆ (This is the same vibe as the AP server checking the transited field when the TRANSITED-POLICY-CHECKED flag hasn't been set [RFC4120].) If that data type is inside an AD-IF-RELEVANT container, AP servers MAY apply local policy to decide whether the authorization data is acceptable ๐Ÿ’œ

A pre-authentication data element shows up in the AS-REP [RFC4120] ๐Ÿฆ‹ Its padata-type is PA_PK_AS_REP, and its padata-value holds the DER encoding of the type PA-PK-AS-REP (defined below):

    PA-PK-AS-REP ::= CHOICE {
       dhInfo                  [0] DHRepInfo,
                -- Selected when Diffie-Hellman key exchange is
                -- used.
       encKeyPack              [1] IMPLICIT OCTET STRING,
                -- Selected when public key encryption is used.
                -- Contains a CMS type ContentInfo encoded
                -- according to [RFC3852].
                -- The contentType field of the type ContentInfo is
                -- id-envelopedData (1.2.840.113549.1.7.3).
                -- The content field is an EnvelopedData.
                -- The contentType field for the type EnvelopedData
                -- is id-signedData (1.2.840.113549.1.7.2).
                -- The eContentType field for the inner type
                -- SignedData (when unencrypted) is
                -- id-pkinit-rkeyData (1.3.6.1.5.2.3.3) and the
                -- eContent field contains the DER encoding of the
                -- type ReplyKeyPack.
                -- ReplyKeyPack is defined in Section 3.2.3.2.
       ...
    }

    DHRepInfo ::= SEQUENCE {
       dhSignedData            [0] IMPLICIT OCTET STRING,
                -- Contains a CMS type ContentInfo encoded according
                -- to [RFC3852].
                -- The contentType field of the type ContentInfo is
                -- id-signedData (1.2.840.113549.1.7.2), and the
                -- content field is a SignedData.
                -- The eContentType field for the type SignedData is
                -- id-pkinit-DHKeyData (1.3.6.1.5.2.3.2), and the
                -- eContent field contains the DER encoding of the
                -- type KDCDHKeyInfo.
                -- KDCDHKeyInfo is defined below.
       serverDHNonce           [1] DHNonce OPTIONAL,
                -- Present if and only if dhKeyExpiration is
                -- present in the KDCDHKeyInfo.
       ...
    }

    KDCDHKeyInfo ::= SEQUENCE {
       subjectPublicKey        [0] BIT STRING,
                -- The KDC's DH public key.
                -- The DH public key value is encoded as a BIT
                -- STRING according to [RFC3279].
       nonce                   [1] INTEGER (0..4294967295),
                -- Contains the nonce in the pkAuthenticator field
                -- in the request if the DH keys are NOT reused,
                -- 0 otherwise.
       dhKeyExpiration         [2] KerberosTime OPTIONAL,
                -- Expiration time for KDC's key pair,
                -- present if and only if the DH keys are reused.
                -- If present, the KDC's DH public key MUST not be
                -- used past the point of this expiration time.
                -- If this field is omitted then the serverDHNonce
                -- field MUST also be omitted.
       ...
    }

Everything else in the AS-REP stays exactly the same as [RFC4120] ๐ŸŽ€ The one big twist is that the KDC encrypts the reply as usual, but NOT with the client's long-term key โœจ Instead, it uses either a shared key from a Diffie-Hellman exchange or a generated encryption key. The contents of the PA-PK-AS-REP tell you which key delivery method got picked ๐Ÿ’–

Now, if the client doesn't want Diffie-Hellman (so the clientPublicValue field isn't in the request) and the KDC doesn't support public key encryption key delivery either, the KDC MUST return an error message with the code KDC_ERR_PUBLIC_KEY_ENCRYPTION_NOT_SUPPORTED ๐Ÿ˜ญ There's no accompanying e-data for this one.

Lifetime check! The ticket lifetime the KDC hands back MUST NOT exceed the lifetime of the client's public-private key pair ๐Ÿšจ The ticket can be shorter than that, though. For implementations of this spec, the client's key pair lifetime is the validity period in X.509 certificates [RFC3280], unless it's configured otherwise ๐ŸŒˆ

3.2.3.1. Using Diffie-Hellman Key Exchange ๐ŸŒธ

okay so in this case the PA-PK-AS-REP carries a DHRepInfo structure ๐ŸŽ€

the ContentInfo [RFC3852] structure for the dhSignedData field gets filled in like this:

  1. the contentType field of the ContentInfo type is id-signedData (as defined in [RFC3852]), and the content field is a SignedData (as defined in [RFC3852]) ๐Ÿ’…
  2. the eContentType field for the SignedData type is the OID for id-pkinit-DHKeyData: { iso(1) org(3) dod(6) internet(1) security(5) kerberosv5(2) pkinit(3) DHKeyData(2) }. notes for my CMS implementers ๐Ÿซถ: the signed attribute content-type MUST be present in this SignedData instance, and its value is id-pkinit-DHKeyData according to [RFC3852].
  3. the eContent field for the SignedData type holds the DER encoding of the KDCDHKeyInfo type โœจ
  4. the KDCDHKeyInfo structure has the KDC's public key, a nonce, and optionally the expiration time of the KDC's DH key being reused ๐Ÿ”ฅ the subjectPublicKey field of KDCDHKeyInfo tells you the KDC's DH public key. that value gets encoded as a BIT STRING according to [RFC3279]. the nonce field has the nonce from the pkAuthenticator field in the request if the DH keys are NOT reused, and it's 0 if the DH keys are reused. the dhKeyExpiration field is present if and only if the DH keys are reused. if dhKeyExpiration is present, the KDC's public key in this KDCDHKeyInfo structure MUST NOT be used past that expiration time ๐Ÿ’€ and if this field is omitted, then the serverDHNonce field MUST also be omitted.
  5. the signerInfos field of the SignedData type holds one single signerInfo, which contains the signature over the KDCDHKeyInfo type ๐Ÿ“
  6. the certificates field of the SignedData type holds certificates meant to help build the certification path, so the client can verify the KDC's signature over KDCDHKeyInfo ๐Ÿฆ‹ the KDC SHOULD use the information in the trustedCertifiers from the request as hints for picking the right certificate chain to send back. this field may be left empty if the KDC public key from the kdcPkId field in the PA-PK-AS-REQ was used for signing. otherwise, for path validation, these certificates SHOULD be enough to build at least one certification path from the KDC certificate to one trust anchor the client accepts [RFC4158]. the KDC MUST be capable of including such a set of certificates if it's configured to do so. and the certificates field MUST NOT contain "root" CA certificates ๐Ÿ™…โ€โ™€๏ธ
  7. if the client included the clientDHNonce field, the KDC may choose to reuse its DH keys ๐Ÿงš if the server reuses them, it MUST include an expiration time in the dhKeyExpiration field. past that expiration time, the signature over the DHRepInfo type is considered expired/invalid. when the server reuses DH keys, it MUST also include a serverDHNonce at least as long as the key length of the symmetric encryption system used to encrypt the AS reply. heads up that including serverDHNonce changes how the client and server calculate the key used to encrypt the reply, so see below for the details โญ the KDC SHOULD NOT reuse DH keys unless the clientDHNonce field is present in the request.

the AS reply key gets derived like this:

  1. both the KDC and the client calculate the shared secret value as follows:

a) when MODP Diffie-Hellman is used, DHSharedSecret is the shared secret value. DHSharedSecret is the value ZZ, as described in Section 2.1.1 of [RFC2631] ๐Ÿ’œ

DHSharedSecret gets padded with leading zeros first, so its size in octets matches the modulus. then it's represented as a string of octets in big-endian order.

Implementation note: both the client and the KDC can cache the triple (ya, yb, DHSharedSecret), where ya is the client's public key and yb is the KDC's public key. if ya and yb are both the same in a later exchange, the cached DHSharedSecret can be reused ๐ŸŒˆ

  1. let K be the key-generation seed length [RFC3961] of the AS reply key whose enctype is selected according to [RFC4120] ๐ŸŽ€
  2. define the function octetstring2key() like this:
octetstring2key(x) == random-to-key(K-truncate(
                         SHA1(0x00 | x) |
                         SHA1(0x01 | x) |
                         SHA1(0x02 | x) |
                         ...
                         ))

where x is an octet string, | is the concatenation operator, and 0x00, 0x01, 0x02, and so on are each represented as a single octet. random-to-key() is an operation that generates a protocol key from a bitstring of length K. K-truncate truncates its input to the first K bits. K and random-to-key() are both as defined in the kcrypto profile [RFC3961] for the enctype of the AS reply key ๐Ÿง

  1. when DH keys are reused, let n_c be the clientDHNonce and n_k be the serverDHNonce. otherwise, let both n_c and n_k be empty octet strings ๐Ÿซง
  2. the AS reply key k is:
k = octetstring2key(DHSharedSecret | n_c | n_k)

3.2.3.2. Using Public Key Encryption ๐Ÿ”

in this case the PA-PK-AS-REP contains the encKeyPack field, where the AS reply key gets encrypted ๐Ÿฅน

the ContentInfo [RFC3852] structure for the encKeyPack field gets filled in like this:

  1. the contentType field of the ContentInfo type is id-envelopedData (as defined in [RFC3852]), and the content field is an EnvelopedData (as defined in [RFC3852]) ๐Ÿ’–
  2. the contentType field for the EnvelopedData type is id-signedData: { iso (1) member-body (2) us (840) rsadsi (113549) pkcs (1) pkcs7 (7) signedData (2) }.
  3. the eContentType field for the inner SignedData type (once it's decrypted from the encryptedContent field of the EnvelopedData type) is id-pkinit-rkeyData: { iso(1) org(3) dod(6) internet(1) security(5) kerberosv5(2) pkinit(3) rkeyData(3) }. notes for CMS implementers: the signed attribute content-type MUST be present in this SignedData instance, and its value is id-pkinit-rkeyData according to [RFC3852].
  4. the eContent field for the inner SignedData type holds the DER encoding of the ReplyKeyPack type (described below) ๐ŸŒท
  5. the signerInfos field of the inner SignedData type holds a single signerInfo, which contains the signature for the ReplyKeyPack type โœจ
  6. the certificates field of the inner SignedData type holds certificates meant to help build the certification path, so the client can verify the KDC's signature for the ReplyKeyPack type. the KDC SHOULD use the information in the trustedCertifiers from the request as hints for picking the right certificate chain to send back. this field may be left empty if the KDC public key from the kdcPkId field in the PA-PK-AS-REQ was used for signing. otherwise, for path validation, these certificates SHOULD be enough to build at least one certification path from the KDC certificate to one trust anchor the client accepts [RFC4158]. the KDC MUST be capable of including such a set of certificates if it's configured to do so. and the certificates field MUST NOT contain "root" CA certificates ๐Ÿ™…โ€โ™€๏ธ
  7. the recipientInfos field of the EnvelopedData type is a SET that MUST contain exactly one member of type KeyTransRecipientInfo. the encryptedKey of this member holds the temporary key, encrypted with the client's public key ๐Ÿฆ‹
  8. the unprotectedAttrs or originatorInfo fields of the EnvelopedData type MAY be present ๐Ÿงš

if there's a supportedCMSTypes field in the AuthPack, the KDC must check whether it supports any of the listed types. if it supports more than one of them, the KDC SHOULD use the one listed first. if it doesn't support any of them, it MUST return an error message with the code KDC_ERR_ETYPE_NOSUPP [RFC4120] ๐Ÿ˜ญ

also, the KDC computes the checksum of the AS-REQ in the client request. this checksum is performed over the AS-REQ type, the protocol key [RFC3961] for the checksum operation is the replyKey, and the key usage number is 6. if the replyKey's enctype is "newer" [RFC4120] [RFC4121], the checksum operation is the required checksum operation [RFC3961] of that enctype ๐Ÿ”ฅ

ReplyKeyPack ::= SEQUENCE {
   replyKey                [0] EncryptionKey,
            -- Contains the session key used to encrypt the
            -- enc-part field in the AS-REP, i.e., the
            -- AS reply key.
   asChecksum              [1] Checksum,
           -- Contains the checksum of the AS-REQ
           -- corresponding to the containing AS-REP.
           -- The checksum is performed over the type AS-REQ.
           -- The protocol key [RFC3961] of the checksum is the
           -- replyKey and the key usage number is 6.
           -- If the replyKey's enctype is "newer" [RFC4120]
           -- [RFC4121], the checksum is the required
           -- checksum operation [RFC3961] for that enctype.
           -- The client MUST verify this checksum upon receipt
           -- of the AS-REP.
   ...
}

implementations of this RSA encryption key delivery method are RECOMMENDED to support RSA keys at least 2048 bits in size ๐Ÿ”‘โœจ

3.2.4. Receipt of KDC Reply ๐Ÿ’–

Okay so, once the KDC's reply lands, the client gets to work ๐Ÿ’… If the PA-PK-AS-REP has the dhSignedData field, the client derives the AS reply key using the same procedure the KDC used, as defined in Section 3.2.3.1. Otherwise the message has the encKeyPack field, so the client decrypts it, pulls the temporary key out of the encryptedKey field of the member KeyTransRecipientInfo, and uses that as the AS reply key โœจ

If the public key encryption method is used, the client MUST verify the asChecksum contained in the ReplyKeyPack ๐Ÿ”

Either way, the client MUST verify the signature in the SignedData according to [RFC3852]. The KDC's X.509 certificate MUST be validated according to [RFC3280]. Also, unless the client can otherwise verify that the public key used to verify the KDC's signature is bound to the KDC of the target realm, the KDC's X.509 certificate MUST contain a Subject Alternative Name extension [RFC3280] carrying an AnotherName whose type-id is id-pkinit-san (as defined in Section 3.2.2) and whose value is a KRB5PrincipalName that matches the name of the TGS of the target realm (as defined in Section 7.3 of [RFC4120]). this is the main character check ๐Ÿ‘‘

Unless the client knows by some other means that the KDC certificate is intended for a Kerberos KDC, the client MUST require that the KDC certificate contains the EKU KeyPurposeId [RFC3280] id-pkinit-KPKdc:

id-pkinit-KPKdc OBJECT IDENTIFIER ::=
  { iso(1) org(3) dod(6) internet(1) security(5) kerberosv5(2)
    pkinit(3) keyPurposeKdc(5) }
       -- Signing KDC responses.
       -- Key usage bits that MUST be consistent:
       -- digitalSignature.

The digitalSignature key usage bit [RFC3280] MUST be asserted when the intended purpose of the KDC's X.509 certificate is restricted with the id-pkinit-KPKdc EKU ๐Ÿฆ‹

If the KDC certificate contains the Kerberos TGS name encoded as an id-pkinit-san SAN, then the issuing CA has certified this certificate as a KDC certificate, so the id-pkinit-KPKdc EKU is not required. that's the kind of shortcut I respect ๐ŸŽ€

If all applicable checks are satisfied, the client then decrypts the enc-part field of the KDC-REP in the AS-REP using the AS reply key, and then carries on as described in [RFC4120] ๐ŸŒˆ

3.3. Interoperability Requirements ๐Ÿงš

The client MUST be capable of sending a set of certificates sufficient to allow the KDC to construct a certification path for the client's certificate, if the correct set of certificates is provided through configuration or policy ๐Ÿ“œ

If the client sends all the X.509 certificates on a certification path to a trust anchor acceptable by the KDC, and if the KDC cannot verify the client's public key otherwise, the KDC MUST be able to process path validation for the client's certificate based on the certificates in the request ๐Ÿ“

The KDC MUST be capable of sending a set of certificates sufficient to allow the client to construct a certification path for the KDC's certificate, if the correct set of certificates is provided through configuration or policy ๐Ÿ’œ

If the KDC sends all the X.509 certificates on a certification path to a trust anchor acceptable by the client, and the client cannot verify the KDC's public key otherwise, the client MUST be able to process path validation for the KDC's certificate based on the certificates in the reply ๐Ÿซถ

3.4. KDC Indication of PKINIT Support ๐ŸŒธ

If pre-authentication is required but was not present in the request, then per [RFC4120] an error message with the code KDC_ERR_PREAUTH_FAILED is returned, and a METHOD-DATA object gets stored in the e-data field of the KRB-ERROR message to say which pre-authentication mechanisms are acceptable. The KDC can then show it supports PKINIT by including an empty element whose padata-type is PA_PK_AS_REQ in that METHOD-DATA object ๐Ÿ™Œ

Otherwise, if the KDC's local policy requires that the client be pre-authenticated using the pre-authentication mechanism specified in this document, but no PKINIT pre-authentication was present in the request, an error message with the code KDC_ERR_PREAUTH_FAILED SHOULD be returned ๐Ÿ’ญ

KDCs MUST leave the padata-value field of the PA_PK_AS_REQ element in the KRB-ERROR's METHOD-DATA empty (i.e., send a zero-length OCTET STRING), and clients MUST ignore this and any other value. Future extensions to this protocol may specify other data to send instead of an empty OCTET STRING ๐Ÿฐ

4. Security Considerations ๐Ÿ”ฅ

okay this section is serious and I'm not joking about it ๐Ÿ˜ญ

The security of cryptographic algorithms depends on generating secret quantities [RFC4086]. The number of truly random bits is extremely important in deciding the attack resistance strength of the cryptosystem. For example, the secret Diffie-Hellman exponents must be chosen based on n truly random bits (where n is the system security requirement). The security of the overall system is significantly weakened by using insufficient random inputs: a sophisticated attacker may find it easier to reproduce the environment that produced the secret quantities and search the resulting small set of possibilities than to locate the quantities in the whole of the potential number space ๐Ÿง 

Kerberos error messages are not integrity protected. As a result, the domain parameters sent by the KDC as TD-DH-PARAMETERS can be tampered with by an attacker, so the set of domain parameters selected could be either weaker or not mutually preferred. Local policy can configure sets of domain parameters acceptable locally, or disallow the negotiation of DH domain parameters ๐Ÿšจ

The symmetric reply key size and Diffie-Hellman field size or RSA modulus size should be chosen so as to provide sufficient cryptographic security [RFC3766] โœจ

When MODP Diffie-Hellman is used, the exponents should have at least twice as many bits as the symmetric keys that will be derived from them [ODL99] ๐Ÿ”ข

PKINIT raises certain security considerations beyond those that can be regulated strictly in protocol definitions. We will address them in this section ๐Ÿ’…

PKINIT extends the cross-realm model to the public-key infrastructure. Users of PKINIT must understand security policies and procedures appropriate to the use of Public Key Infrastructures [RFC3280] ๐Ÿฐ

In order to trust a KDC certificate that is certified by a CA as a KDC certificate for a target realm (for example, by asserting the TGS name of that Kerberos realm as an id-pkinit-san SAN and/or restricting the certificate usage by using the id-pkinit-KPKdc EKU, as described in Section 3.2.4), the client MUST verify that the KDC certificate's issuing CA is authorized to issue KDC certificates for that target realm. Otherwise, the binding between the KDC certificate and the KDC of the target realm is not established. this one is SO important ๐ŸŒˆ

How to validate this authorization is a matter of local policy. One way to achieve this is by configuring specific sets of intermediary CAs and trust anchors, one of which must be on the KDC certificate's certification path [RFC3280], and, for each CA or trust anchor, the realms for which it is allowed to issue certificates ๐Ÿ—บ๏ธ

In addition, if any CA that is trusted to issue KDC certificates can also issue other kinds of certificates, then local policy must be able to distinguish between them. For example, it could require that KDC certificates contain the id-pkinit-KPKdc EKU, or that the realm be specified with the id-pkinit-san SAN ๐Ÿ•ต๏ธ

It is the responsibility of the PKI administrators for an organization to ensure that KDC certificates are only issued to KDCs, and that clients can ascertain this using their local policy ๐Ÿ”‘

Standard Kerberos allows the possibility of interactions between cryptosystems of varying strengths. This document adds interactions with public-key cryptosystems to Kerberos. Some administrative policies may allow the use of relatively weak public keys. When such weak asymmetric keys are used to protect or exchange stronger symmetric keys, the attack resistance strength of the overall system is no better than that of these weak keys [RFC3766] ๐Ÿฅ€

PKINIT requires that keys for symmetric cryptosystems be generated. Some such systems contain "weak" keys. For recommendations regarding these weak keys, see [RFC4120] ๐Ÿงช

PKINIT allows the use of the same RSA key pair for encryption and signing when doing RSA encryption-based key delivery. This is not recommended usage of RSA keys [RFC3447]. By using DH-based key delivery, this is avoided ๐Ÿ™ˆ

Care should be taken in how certificates are chosen for the purposes of authentication using PKINIT. Some local policies may require that key escrow be used for certain certificate types. Deployers of PKINIT should be aware of the implications of using certificates that have escrowed keys for authentication. Because signing-only certificates are normally not escrowed, using DH-based key delivery avoids this ๐Ÿ—๏ธ

PKINIT does not provide for a "return routability" test to prevent attackers from mounting a denial-of-service attack on the KDC by causing it to perform unnecessary and expensive public-key operations. Strictly speaking, this is also true of standard Kerberos, although the potential cost is not as great, because standard Kerberos does not make use of public-key cryptography. By using DH-based key delivery and reusing DH keys, the necessary crypto processing cost per request can be minimized ๐Ÿ’ธ

When the Diffie-Hellman key exchange method is used, additional pre-authentication data [RFC4120] (in addition to the PA_PK_AS_REQ, as defined in this specification) is not bound to the AS_REQ by the mechanisms discussed in this specification. This means it may be dropped or added by attackers without being detected by either the client or the KDC. Designers of additional pre-authentication data should take that into consideration if such data can be used in conjunction with the PA_PK_AS_REQ. The future work of the Kerberos working group is expected to update the hash algorithms specified in this document and provide a generic mechanism to bind additional pre-authentication data with the accompanying AS_REQ ๐Ÿ•ธ๏ธ

The key usage number 6 used by the asChecksum field is also used for the authenticator checksum (cksum field of AP-REQ) contained in the PA-TGS-REQ preauthentication data contained in a TGS-REQ [RFC4120]. This conflict is present for historical reasons. The reuse of key usage numbers is strongly discouraged ๐Ÿซ 

5. Acknowledgements โœจ

okay bestie, this is the shoutout section ๐Ÿซถ so many people made this doc happen! The big contributors are Paul Leach, Stefan Santesson, Sam Hartman, Love Hornquist Astrand, Ken Raeburn, Nicolas Williams, John Wray, Tom Yu, Jeffrey Hutzelman, David Cross, Dan Simon, Karthik Jaganathan, Chaskiel M Grundman, and Jeffrey Altman. iconic cast ๐Ÿ’…

Andre Scedrov, Aaron D. Jaggard, Iliano Cervesato, Joe-Kai Tsay, and Chris Walstad caught a binding issue between the AS-REQ and AS-REP in draft -26 ๐Ÿ” and that's how the asChecksum field got added. Literally a main character moment for them ๐Ÿฆ‹

Special thanks to Clifford Neuman, Matthew Hur, Ari Medvinsky, Sasha Medvinsky, and Jonathan Trostle, who wrote the earlier versions of this document ๐ŸŒธ

The authors also owe a lot to Jeffrey Hutzelman, the Kerberos working group chair ๐Ÿ‘‘. He tracked the various issues and was seriously so helpful the whole time this was being written.

Some of the ideas here came out of years of conversations between members of the SAAG, the IETF CAT working group, and the PSRG about bringing Kerberos and SPX together โœจ. Some ideas were also borrowed from the DASS system. BUT, and this is important, these changes are not endorsed by those groups. This is more of an attempt to revive some of their goals, and this document comes at those goals mostly from the Kerberos side ๐Ÿงš

And lastly, the folks working on similar ideas in DCE gave super valuable feedback ๐Ÿ’œ


6. References

6.1. Normative References

[IEEE1363] IEEE, "Standard Specifications for Public Key
           Cryptography", IEEE 1363, 2000.

[RFC2119]  Bradner, S., "Key words for use in RFCs to Indicate
           Requirement Levels", BCP 14, RFC 2119, March 1997.

[RFC2412]  Orman, H., "The OAKLEY Key Determination Protocol", RFC
           2412, November 1998.

[RFC2631]  Rescorla, E., "Diffie-Hellman Key Agreement Method", RFC
           2631, June 1999.

[RFC3279]  Bassham, L., Polk, W., and R. Housley, "Algorithms and
           Identifiers for the Internet X.509 Public Key
           Infrastructure Certificate and Certificate Revocation List
           (CRL) Profile", RFC 3279, April 2002.

[RFC3280]  Housley, R., Polk, W., Ford, W., and D. Solo, "Internet
           X.509 Public Key Infrastructure Certificate and
           Certificate Revocation List (CRL) Profile", RFC 3280,
           April 2002.

[RFC3370]  Housley, R., "Cryptographic Message Syntax (CMS)
           Algorithms", RFC 3370, August 2002.

[RFC3447]  Jonsson, J. and B. Kaliski, "Public-Key Cryptography
           Standards (PKCS) #1: RSA Cryptography Specifications
           Version 2.1", RFC 3447, February 2003.

[RFC3526]  Kivinen, T. and M. Kojo, "More Modular Exponential (MODP)
           Diffie-Hellman groups for Internet Key Exchange (IKE)",
           RFC 3526, May 2003.

[RFC3560]  Housley, R., "Use of the RSAES-OAEP Key Transport
           Algorithm in Cryptographic Message Syntax (CMS)", RFC
           3560, July 2003.

[RFC3766]  Orman, H. and P. Hoffman, "Determining Strengths For
           Public Keys Used For Exchanging Symmetric Keys", BCP 86,
           RFC 3766, April 2004.

[RFC3852]  Housley, R., "Cryptographic Message Syntax (CMS)", RFC
           3852, July 2004.

[RFC3961]  Raeburn, K., "Encryption and Checksum Specifications for
           Kerberos 5", RFC 3961, February 2005.

[RFC3962]  Raeburn, K., "Advanced Encryption Standard (AES)
           Encryption for Kerberos 5", RFC 3962, February 2005.

[RFC4086]  Eastlake, D., 3rd, Schiller, J., and S. Crocker,
           "Randomness Requirements for Security", BCP 106, RFC 4086,
           June 2005.

[RFC4120]  Neuman, C., Yu, T., Hartman, S., and K. Raeburn, "The
           Kerberos Network Authentication Service (V5)", RFC 4120,
           July 2005.

[X680]     ITU-T Recommendation X.680 (2002) | ISO/IEC 8824-1:2002,
           Information technology - Abstract Syntax Notation One
           (ASN.1): Specification of basic notation.

[X690]     ITU-T Recommendation X.690 (2002) | ISO/IEC 8825-1:2002,
           Information technology - ASN.1 encoding Rules:
           Specification of Basic Encoding Rules (BER), Canonical
           Encoding Rules (CER) and Distinguished Encoding Rules
           (DER).

6.2. Informative References

These ones are just extra reading, not required stuff ๐Ÿ“š

[ODL99]    Odlyzko, A., "Discrete logarithms: The past and the
           future, Designs, Codes, and Cryptography (1999)".  April
           1999.

[RFC4121]  Zhu, L., Jaganathan, K., and S. Hartman, "The Kerberos
           Version 5 Generic Security Service Application Program
           Interface (GSS-API) Mechanism: Version 2", RFC 4121, July
           2005.

[RFC4158]  Cooper, M., Dzambasow, Y., Hesse, P., Joseph, S., and R.
           Nicholas, "Internet X.509 Public Key Infrastructure:
           Certification Path Building", RFC 4158, September 2005.

Appendix A. PKINIT ASN.1 Module ๐ŸŽ€

Okay so this is the ASN.1 module, the actual formal definitions ๐Ÿค“ It's the source of truth for all the message shapes we've been talking about, so it's giving precision. Here it is, word for word:

   KerberosV5-PK-INIT-SPEC {
           iso(1) identified-organization(3) dod(6) internet(1)
           security(5) kerberosV5(2) modules(4) pkinit(5)
   } DEFINITIONS EXPLICIT TAGS ::= BEGIN

   IMPORTS

       SubjectPublicKeyInfo, AlgorithmIdentifier
           FROM PKIX1Explicit88 { iso (1)
             identified-organization (3) dod (6) internet (1)
             security (5) mechanisms (5) pkix (7) id-mod (0)
             id-pkix1-explicit (18) }
             -- As defined in RFC 3280.

       KerberosTime, PrincipalName, Realm, EncryptionKey, Checksum
           FROM KerberosV5Spec2 { iso(1) identified-organization(3)
             dod(6) internet(1) security(5) kerberosV5(2)
             modules(4) krb5spec2(2) };
             -- as defined in RFC 4120.

   id-pkinit OBJECT IDENTIFIER ::=
     { iso(1) identified-organization(3) dod(6) internet(1)
       security(5) kerberosv5(2) pkinit (3) }

   id-pkinit-authData      OBJECT IDENTIFIER  ::= { id-pkinit 1 }
   id-pkinit-DHKeyData     OBJECT IDENTIFIER  ::= { id-pkinit 2 }
   id-pkinit-rkeyData      OBJECT IDENTIFIER  ::= { id-pkinit 3 }
   id-pkinit-KPClientAuth  OBJECT IDENTIFIER  ::= { id-pkinit 4 }
   id-pkinit-KPKdc         OBJECT IDENTIFIER  ::= { id-pkinit 5 }

   id-pkinit-san OBJECT IDENTIFIER ::=
     { iso(1) org(3) dod(6) internet(1) security(5) kerberosv5(2)
       x509SanAN (2) }

   pa-pk-as-req INTEGER ::=                  16
   pa-pk-as-rep INTEGER ::=                  17

   ad-initial-verified-cas INTEGER ::=        9

   td-trusted-certifiers INTEGER ::=        104
   td-invalid-certificates INTEGER ::=      105
   td-dh-parameters INTEGER ::=             109

   PA-PK-AS-REQ ::= SEQUENCE {
      signedAuthPack          [0] IMPLICIT OCTET STRING,
               -- Contains a CMS type ContentInfo encoded
               -- according to [RFC3852].
               -- The contentType field of the type ContentInfo
               -- is id-signedData (1.2.840.113549.1.7.2),
               -- and the content field is a SignedData.
               -- The eContentType field for the type SignedData is
               -- id-pkinit-authData (1.3.6.1.5.2.3.1), and the
               -- eContent field contains the DER encoding of the
               -- type AuthPack.
               -- AuthPack is defined below.
      trustedCertifiers       [1] SEQUENCE OF
                  ExternalPrincipalIdentifier OPTIONAL,
               -- Contains a list of CAs, trusted by the client,
               -- that can be used to certify the KDC.
               -- Each ExternalPrincipalIdentifier identifies a CA
               -- or a CA certificate (thereby its public key).
               -- The information contained in the
               -- trustedCertifiers SHOULD be used by the KDC as
               -- hints to guide its selection of an appropriate
               -- certificate chain to return to the client.
      kdcPkId                 [2] IMPLICIT OCTET STRING
                                  OPTIONAL,
               -- Contains a CMS type SignerIdentifier encoded
               -- according to [RFC3852].
               -- Identifies, if present, a particular KDC
               -- public key that the client already has.
      ...
   }

   DHNonce ::= OCTET STRING

   ExternalPrincipalIdentifier ::= SEQUENCE {
      subjectName            [0] IMPLICIT OCTET STRING OPTIONAL,
               -- Contains a PKIX type Name encoded according to
               -- [RFC3280].
               -- Identifies the certificate subject by the
               -- distinguished subject name.
               -- REQUIRED when there is a distinguished subject
               -- name present in the certificate.
     issuerAndSerialNumber   [1] IMPLICIT OCTET STRING OPTIONAL,
               -- Contains a CMS type IssuerAndSerialNumber encoded
               -- according to [RFC3852].
               -- Identifies a certificate of the subject.
               -- REQUIRED for TD-INVALID-CERTIFICATES and
               -- TD-TRUSTED-CERTIFIERS.
     subjectKeyIdentifier    [2] IMPLICIT OCTET STRING OPTIONAL,
               -- Identifies the subject's public key by a key
               -- identifier.  When an X.509 certificate is
               -- referenced, this key identifier matches the X.509
               -- subjectKeyIdentifier extension value.  When other
               -- certificate formats are referenced, the documents
               -- that specify the certificate format and their use
               -- with the CMS must include details on matching the
               -- key identifier to the appropriate certificate
               -- field.
               -- RECOMMENDED for TD-TRUSTED-CERTIFIERS.
      ...
   }

   AuthPack ::= SEQUENCE {
      pkAuthenticator         [0] PKAuthenticator,
      clientPublicValue       [1] SubjectPublicKeyInfo OPTIONAL,
               -- Type SubjectPublicKeyInfo is defined in
               -- [RFC3280].
               -- Specifies Diffie-Hellman domain parameters
               -- and the client's public key value [IEEE1363].
               -- The DH public key value is encoded as a BIT
               -- STRING according to [RFC3279].
               -- This field is present only if the client wishes
               -- to use the Diffie-Hellman key agreement method.
      supportedCMSTypes       [2] SEQUENCE OF AlgorithmIdentifier
                                  OPTIONAL,
               -- Type AlgorithmIdentifier is defined in
               -- [RFC3280].
               -- List of CMS algorithm [RFC3370] identifiers
               -- that identify key transport algorithms, or
               -- content encryption algorithms, or signature
               -- algorithms supported by the client in order of
               -- (decreasing) preference.
      clientDHNonce           [3] DHNonce OPTIONAL,
               -- Present only if the client indicates that it
               -- wishes to reuse DH keys or to allow the KDC to
               -- do so.
      ...
   }

Okay bestie, we're picking up in the ASN.1 module, so let's keep going ๐ŸŽ€

Here's the PKAuthenticator, which is lowkey the star of the show because it carries the replay-prevention stuff. The paChecksum field is basically a SHA1 receipt over the request body, and it's marked as a MUST, so it's not optional, no cap ๐Ÿ’…

       PKAuthenticator ::= SEQUENCE {
          cusec                   [0] INTEGER (0..999999),
          ctime                   [1] KerberosTime,
                   -- cusec and ctime are used as in [RFC4120], for
                   -- replay prevention.
          nonce                   [2] INTEGER (0..4294967295),
                   -- Chosen randomly; this nonce does not need to
                   -- match with the nonce in the KDC-REQ-BODY.
          paChecksum              [3] OCTET STRING OPTIONAL,
                   -- MUST be present.
                   -- Contains the SHA1 checksum, performed over
                   -- KDC-REQ-BODY.
          ...
       }

       TD-TRUSTED-CERTIFIERS ::= SEQUENCE OF
                      ExternalPrincipalIdentifier
                   -- Identifies a list of CAs trusted by the KDC.
                   -- Each ExternalPrincipalIdentifier identifies a CA
                   -- or a CA certificate (thereby its public key).

       TD-INVALID-CERTIFICATES ::= SEQUENCE OF
                      ExternalPrincipalIdentifier
                   -- Each ExternalPrincipalIdentifier identifies a
                   -- certificate (sent by the client) with an invalid
                   -- signature.

       KRB5PrincipalName ::= SEQUENCE {
           realm                   [0] Realm,
           principalName           [1] PrincipalName
       }

       AD-INITIAL-VERIFIED-CAS ::= SEQUENCE OF
                      ExternalPrincipalIdentifier
                   -- Identifies the certification path based on which
                   -- the client certificate was validated.
                   -- Each ExternalPrincipalIdentifier identifies a CA
                   -- or a CA certificate (thereby its public key).

       PA-PK-AS-REP ::= CHOICE {
          dhInfo                  [0] DHRepInfo,
                   -- Selected when Diffie-Hellman key exchange is
                   -- used.
          encKeyPack              [1] IMPLICIT OCTET STRING,
                   -- Selected when public key encryption is used.
                   -- Contains a CMS type ContentInfo encoded
                   -- according to [RFC3852].
                   -- The contentType field of the type ContentInfo is
                   -- id-envelopedData (1.2.840.113549.1.7.3).
                   -- The content field is an EnvelopedData.
                   -- The contentType field for the type EnvelopedData
                   -- is id-signedData (1.2.840.113549.1.7.2).
                   -- The eContentType field for the inner type
                   -- SignedData (when unencrypted) is
                   -- id-pkinit-rkeyData (1.3.6.1.5.2.3.3) and the
                   -- eContent field contains the DER encoding of the
                   -- type ReplyKeyPack.
                   -- ReplyKeyPack is defined below.
          ...

       }

       DHRepInfo ::= SEQUENCE {
          dhSignedData            [0] IMPLICIT OCTET STRING,
                   -- Contains a CMS type ContentInfo encoded according
                   -- to [RFC3852].
                   -- The contentType field of the type ContentInfo is
                   -- id-signedData (1.2.840.113549.1.7.2), and the
                   -- content field is a SignedData.
                   -- The eContentType field for the type SignedData is
                   -- id-pkinit-DHKeyData (1.3.6.1.5.2.3.2), and the
                   -- eContent field contains the DER encoding of the
                   -- type KDCDHKeyInfo.
                   -- KDCDHKeyInfo is defined below.
          serverDHNonce           [1] DHNonce OPTIONAL,
                   -- Present if and only if dhKeyExpiration is
                   -- present.
          ...
       }

       KDCDHKeyInfo ::= SEQUENCE {
          subjectPublicKey        [0] BIT STRING,
                   -- The KDC's DH public key.
                   -- The DH public key value is encoded as a BIT
                   -- STRING according to [RFC3279].
          nonce                   [1] INTEGER (0..4294967295),
                   -- Contains the nonce in the pkAuthenticator field
                   -- in the request if the DH keys are NOT reused,
                   -- 0 otherwise.
          dhKeyExpiration         [2] KerberosTime OPTIONAL,
                   -- Expiration time for KDC's key pair,
                   -- present if and only if the DH keys are reused.
                   -- If present, the KDC's DH public key MUST not be
                   -- used past the point of this expiration time.
                   -- If this field is omitted then the serverDHNonce
                   -- field MUST also be omitted.
          ...
       }

       ReplyKeyPack ::= SEQUENCE {
          replyKey                [0] EncryptionKey,
                   -- Contains the session key used to encrypt the
                   -- enc-part field in the AS-REP, i.e., the
                   -- AS reply key.
          asChecksum              [1] Checksum,
                  -- Contains the checksum of the AS-REQ
                  -- corresponding to the containing AS-REP.
                  -- The checksum is performed over the type AS-REQ.

                  -- The protocol key [RFC3961] of the checksum is the
                  -- replyKey and the key usage number is 6.
                  -- If the replyKey's enctype is "newer" [RFC4120]
                  -- [RFC4121], the checksum is the required
                  -- checksum operation [RFC3961] for that enctype.
                  -- The client MUST verify this checksum upon receipt
                  -- of the AS-REP.
          ...
       }

       TD-DH-PARAMETERS ::= SEQUENCE OF AlgorithmIdentifier
                   -- Each AlgorithmIdentifier specifies a set of
                   -- Diffie-Hellman domain parameters [IEEE1363].
                   -- This list is in decreasing preference order.
       END

Appendix B. Test Vectors โœจ

okay this appendix is a whole test-vector buffet ๐Ÿ“ octetstring2key() is defined back in Section 3.2.3.1, and this part gives you a few sets of vectors that implementers can use to check their octetstring2key() ๐Ÿงš

Set 1:

Input octet string x is:

00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

Output of K-truncate() when the key size is 32 octets:

5e e5 0d 67 5c 80 9f e5 9e 4a 77 62 c5 4b 65 83
75 47 ea fb 15 9b d8 cd c7 5f fc a5 91 1e 4c 41

Set 2:

Input octet string x is:

00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

Output of K-truncate() when the key size is 32 octets:

ac f7 70 7c 08 97 3d df db 27 cd 36 14 42 cc fb
a3 55 c8 88 4c b4 72 f3 7d a6 36 d0 7d 56 78 7e

Set 3:

Input octet string x is:

00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f
10 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e
0f 10 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d
0e 0f 10 00 01 02 03 04 05 06 07 08 09 0a 0b 0c
0d 0e 0f 10 00 01 02 03 04 05 06 07 08 09 0a 0b
0c 0d 0e 0f 10 00 01 02 03 04 05 06 07 08 09 0a
0b 0c 0d 0e 0f 10 00 01 02 03 04 05 06 07 08 09
0a 0b 0c 0d 0e 0f 10 00 01 02 03 04 05 06 07 08

Output of K-truncate() when the key size is 32 octets:

c4 42 da 58 5f cb 80 e4 3b 47 94 6f 25 40 93 e3
73 29 d9 90 01 38 0d b7 83 71 db 3a cf 5c 79 7e

Set 4:

Input octet string x is:

00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f
10 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e
0f 10 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d
0e 0f 10 00 01 02 03 04 05 06 07 08 09 0a 0b 0c
0d 0e 0f 10 00 01 02 03 04 05 06 07 08

Output of K-truncate() when the key size is 32 octets:

00 53 95 3b 84 c8 96 f4 eb 38 5c 3f 2e 75 1c 4a
59 0e d6 ff ad ca 6f f6 4f 47 eb eb 8d 78 0f fc

Appendix C. Miscellaneous Information about Microsoft Windows PKINIT Implementations ๐ŸŒˆ


Earlier revisions of the PKINIT I-D were implemented in various releases of Microsoft Windows and deployed in fairly large numbers. To enable the community to interoperate better with systems running those releases, the following information may be useful.

KDC certificates issued by Windows 2000 Enterprise CAs contain a dNSName SAN with the DNS name of the host running the KDC, and the id-kp-serverAuth EKU [RFC3280].

KDC certificates issued by Windows 2003 Enterprise CAs contain a dNSName SAN with the DNS name of the host running the KDC, the id-kp-serverAuth EKU, and the id-ms-kp-sc-logon EKU.

It is anticipated that the next release of Windows is already too far along to allow it to support the issuing KDC certificates with id-pkinit-san SAN as specified in this RFC. Instead, they will have a dNSName SAN containing the domain name of the KDC, and the intended purpose of these KDC certificates will be restricted by the presence of the id-pkinit-KPKdc EKU and id-kp-serverAuth EKU.

In addition to checking that the above are present in a KDC certificate, Windows clients verify that the issuer of the KDC certificate is one of a set of allowed issuers of such certificates, so those wishing to issue KDC certificates need to configure their Windows clients appropriately.

Client certificates accepted by Windows 2000 and Windows 2003 Server KDCs must contain an id-ms-san-sc-logon-upn (1.3.6.1.4.1.311.20.2.3) SAN and the id-ms-kp-sc-logon EKU. The id-ms-san-sc-logon-upn SAN contains a UTF8-encoded string whose value is that of the Directory Service attribute UserPrincipalName of the client account object, and the purpose of including the id-ms-san-sc-logon-upn SAN in the client certificate is to validate the client mapping (in other words, the client's public key is bound to the account that has this UserPrincipalName value).

It should be noted that all Microsoft Kerberos realm names are domain-style realm names and strictly in uppercase. In addition, the UserPrincipalName attribute is globally unique in Windows 2000 and Windows 2003.

Authors' Addresses ๐Ÿ’Œ

Larry Zhu
Microsoft Corporation
One Microsoft Way
Redmond, WA  98052
US

EMail: lzhu@microsoft.com
Brian Tung
Aerospace Corporation
2350 E. El Segundo Blvd.
El Segundo, CA  90245
US

EMail: brian@aero.org

Okay bestie, this is the legal part ๐Ÿ™ˆ but it's important, so stay with me. Copyright (C) The Internet Society (2006) ๐Ÿ’–

This document is subject to the rights, licenses and restrictions contained in BCP 78, and except as set forth therein, the authors retain all their rights.

This document and the information contained herein are provided on an "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY AND THE INTERNET ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.

Intellectual Property ๐Ÿฆ‹

The IETF takes no position on whether any Intellectual Property Rights or other rights that someone might claim over the technology in this document are valid or how far they reach. It also doesn't say whether a license under those rights might or might not be available, and it doesn't claim to have independently searched for any such rights. If you want to know how rights in RFC documents work, the procedures are in BCP 78 and BCP 79 ๐Ÿ“š

Copies of IPR disclosures made to the IETF Secretariat, along with any assurances of licenses that will be made available, can be found in the IETF online IPR repository at http://www.ietf.org/ipr. The same goes for the result of any attempt to get a general license or permission for implementers or users of this specification to use those proprietary rights.

The IETF also invites anyone interested to bring to its attention any copyrights, patents or patent applications, or other proprietary rights that might cover technology needed to implement this standard. Send that information to the IETF at ietf-ipr@ietf.org ๐Ÿ’Œ

Acknowledgement ๐ŸŒธ

Funding for the RFC Editor function is provided by the IETF Administrative Support Activity (IASA) ๐Ÿซถ

๐Ÿ“ฆ where this page comes from