Internet Engineering Task Force (IETF) M. Jenkins Request for Comments: 8009 National Security Agency Category: Informational M. Peck ISSN: 2070-1721 The MITRE Corporation K. Burgin October 2016
AES Encryption with HMAC-SHA2 for Kerberos 5
Abstract
This document specifies two encryption types and two corresponding checksum types for Kerberos 5. The new types use AES in CTS mode (CBC mode with ciphertext stealing) for confidentiality and HMAC with a SHA-2 hash for integrity.
Status of This Memo
This document is not an Internet Standards Track specification; it is published for informational purposes.
This document is a product of the Internet Engineering Task Force (IETF). It represents the consensus of the IETF community. It has received public review and has been approved for publication by the Internet Engineering Steering Group (IESG). Not all documents approved by the IESG are a candidate for any level of Internet Standard; see Section 2 of RFC 7841.
Information about the current status of this document, any errata, and how to provide feedback on it may be obtained at http://www.rfc-editor.org/info/rfc8009.
Copyright Notice
Copyright (c) 2016 IETF Trust and the persons identified as the document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (http://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License.
Jenkins, et al. Informational [Page 1]
RFC 8009 AES-CTS HMAC-SHA2 For Kerberos 5 October 2016
This document defines two encryption types and two corresponding checksum types for Kerberos 5 using AES with 128-bit or 256-bit keys.
To avoid ciphertext expansion, we use a variation of the CBC-CS3 mode defined in [SP800-38A+], also referred to as ciphertext stealing or CTS mode. The new types conform to the framework specified in [RFC3961], but do not use the simplified profile, as the simplified profile is not compliant with modern cryptographic best practices such as calculating Message Authentication Codes (MACs) over ciphertext rather than plaintext.
The encryption and checksum types defined in this document are intended to support environments that desire to use SHA-256 or SHA-384 (defined in [FIPS180]) as the hash algorithm. Differences between the encryption and checksum types defined in this document and the pre-existing Kerberos AES encryption and checksum types specified in [RFC3962] are:
* The pseudorandom function (PRF) used by PBKDF2 is HMAC-SHA-256 or HMAC-SHA-384. (HMAC is defined in [RFC2104].)
* A key derivation function from [SP800-108] using the SHA-256 or SHA-384 hash algorithm is used to produce keys for encryption, integrity protection, and checksum operations.
Jenkins, et al. Informational [Page 2]
RFC 8009 AES-CTS HMAC-SHA2 For Kerberos 5 October 2016
* The HMAC is calculated over the cipher state concatenated with the AES output, instead of being calculated over the confounder and plaintext. This allows the message receiver to verify the integrity of the message before decrypting the message.
* The HMAC algorithm uses the SHA-256 or SHA-384 hash algorithm for integrity protection and checksum operations.
The AES key space is dense, so we can use random or pseudorandom octet strings directly as keys. The byte representation for the key is described in [FIPS197], where the first bit of the bit string is the high bit of the first byte of the byte string (octet string).
We use a key derivation function from Section 5.1 of [SP800-108], which uses the HMAC algorithm as the PRF.
function KDF-HMAC-SHA2(key, label, [context,] k): k-truncate(K1)
where the value of K1 is computed as below.
key: The source of entropy from which subsequent keys are derived. (This is known as "Ki" in [SP800-108].)
label: An octet string describing the intended usage of the derived key.
context: This parameter is optional. An octet string containing the information related to the derived keying material. This specification does not dictate a specific format for the context field. The context field is only used by the pseudorandom function defined in Section 5, where it is set to the pseudorandom function's octet-string input parameter. The content of the octet-string input parameter is defined by the application that uses it.
k: Length in bits of the key to be outputted, expressed in big-endian binary representation in 4 bytes. (This is called "L" in [SP800-108].) Specifically, k=128 is represented as 0x00000080, 192 as 0x000000C0, 256 as 0x00000100, and 384 as 0x00000180.
When the encryption type is aes128-cts-hmac-sha256-128, k must be no greater than 256 bits. When the encryption type is aes256-cts-hmac-sha384-192, k must be no greater than 384 bits.
Jenkins, et al. Informational [Page 3]
RFC 8009 AES-CTS HMAC-SHA2 For Kerberos 5 October 2016
The k-truncate function is defined in Section 5.1 of [RFC3961]. It returns the 'k' leftmost bits of the bit-string input.
In all computations in this document, "|" indicates concatenation.
When the encryption type is aes128-cts-hmac-sha256-128, then K1 is computed as follows:
If the context parameter is not present: K1 = HMAC-SHA-256(key, 0x00000001 | label | 0x00 | k)
If the context parameter is present: K1 = HMAC-SHA-256(key, 0x00000001 | label | 0x00 | context | k)
When the encryption type is aes256-cts-hmac-sha384-192, then K1 is computed as follows:
If the context parameter is not present: K1 = HMAC-SHA-384(key, 0x00000001 | label | 0x00 | k)
If the context parameter is present: K1 = HMAC-SHA-384(key, 0x00000001 | label | 0x00 | context | k)
In the definitions of K1 above, '0x00000001' is the i parameter (the iteration counter) from Section 5.1 of [SP800-108].
As defined below, the string-to-key function uses PBKDF2 [RFC2898] and KDF-HMAC-SHA2 to derive the base-key from a passphrase and salt. The string-to-key parameter string is 4 octets indicating an unsigned number in big-endian order, consistent with [RFC3962], except that the default is decimal 32768 if the parameter is not specified.
To ensure that different long-term base-keys are used with different enctypes, we prepend the enctype name to the salt, separated by a null byte. The enctype-name is "aes128-cts-hmac-sha256-128" or "aes256-cts-hmac-sha384-192" (without the quotes).
Jenkins, et al. Informational [Page 4]
RFC 8009 AES-CTS HMAC-SHA2 For Kerberos 5 October 2016
The user's long-term base-key is derived as follows:
where "kerberos" is the octet-string 0x6B65726265726F73.
where PBKDF2 is the function of that name from RFC 2898, the pseudorandom function used by PBKDF2 is HMAC-SHA-256 when the enctype is "aes128-cts-hmac-sha256-128" and HMAC-SHA-384 when the enctype is "aes256-cts-hmac-sha384-192", the value for keylength is the AES key length (128 or 256 bits), and the algorithm KDF-HMAC-SHA2 is defined in Section 3.
The cipher state defined in RFC 3961 that maintains cryptographic state across different encryption operations using the same key is used as the formal initialization vector (IV) input into CBC-CS3. The plaintext is prepended with a 16-octet random value generated by the message originator, known as a confounder.
The ciphertext is a concatenation of the output of AES in CBC-CS3 mode and the HMAC of the cipher state concatenated with the AES output. The HMAC is computed using either SHA-256 or SHA-384 depending on the encryption type. The output of HMAC-SHA-256 is truncated to 128 bits, and the output of HMAC-SHA-384 is truncated to 192 bits. Sample test vectors are given in Appendix A.
Decryption is performed by removing the HMAC, verifying the HMAC against the cipher state concatenated with the ciphertext, and then decrypting the ciphertext if the HMAC is correct. Finally, the first 16 octets of the decryption output (the confounder) is discarded, and the remainder is returned as the plaintext decryption output.
The following parameters apply to the encryption types aes128-cts-hmac-sha256-128 and aes256-cts-hmac-sha384-192.
default string-to-key parameters: iteration count of decimal 32768.
random-to-key function: identity function.
key-derivation function: KDF-HMAC-SHA2 as defined in Section 3. The key usage number is expressed as 4 octets in big-endian order.
If the enctype is aes128-cts-hmac-sha256-128: Kc = KDF-HMAC-SHA2(base-key, usage | 0x99, 128) Ke = KDF-HMAC-SHA2(base-key, usage | 0xAA, 128) Ki = KDF-HMAC-SHA2(base-key, usage | 0x55, 128)
If the enctype is aes256-cts-hmac-sha384-192: Kc = KDF-HMAC-SHA2(base-key, usage | 0x99, 192) Ke = KDF-HMAC-SHA2(base-key, usage | 0xAA, 256) Ki = KDF-HMAC-SHA2(base-key, usage | 0x55, 192)
cipher state: a 128-bit CBC initialization vector derived from a previous ciphertext (if any) using the same encryption key, as specified below.
initial cipher state: all bits zero.
encryption function: as follows, where E() is AES encryption in CBC-CS3 mode, and h is the size of truncated HMAC (128 bits or 192 bits as described above).
N = random value of length 128 bits (the AES block size) IV = cipher state C = E(Ke, N | plaintext, IV) H = HMAC(Ki, IV | C) ciphertext = C | H[1..h]
Jenkins, et al. Informational [Page 6]
RFC 8009 AES-CTS HMAC-SHA2 For Kerberos 5 October 2016
Steps to compute the 128-bit cipher state: L = length of C in bits portion C into 128-bit blocks, placing any remainder of less than 128 bits into a final block if L == 128: cipher state = C else if L mod 128 > 0: cipher state = last full (128-bit) block of C (the next-to-last block) else if L mod 128 == 0: cipher state = next-to-last block of C
(Note that L will never be less than 128 because of the presence of N in the encryption input.)
decryption function: as follows, where D() is AES decryption in CBC-CS3 mode, and h is the size of truncated HMAC.
(C, H) = ciphertext (Note: H is the last h bits of the ciphertext.) IV = cipher state if H != HMAC(Ki, IV | C)[1..h] stop, report error (N, P) = D(Ke, C, IV)
(Note: N is set to the first block of the decryption output; P is set to the rest of the output.)
cipher state = same as described above in encryption function
pseudorandom function: If the enctype is aes128-cts-hmac-sha256-128: PRF = KDF-HMAC-SHA2(input-key, "prf", octet-string, 256)
If the enctype is aes256-cts-hmac-sha384-192: PRF = KDF-HMAC-SHA2(input-key, "prf", octet-string, 384)
The following parameters apply to the checksum types hmac-sha256-128-aes128 and hmac-sha384-192-aes256, which are the associated checksums for aes128-cts-hmac-sha256-128 and aes256-cts-hmac-sha384-192, respectively.
associated cryptosystem: aes128-cts-hmac-sha256-128 or aes256-cts-hmac-sha384-192 as appropriate.
Jenkins, et al. Informational [Page 7]
RFC 8009 AES-CTS HMAC-SHA2 For Kerberos 5 October 2016
get_mic: HMAC(Kc, message)[1..h]. where h is 128 bits for checksum type hmac-sha256-128-aes128 and 192 bits for checksum type hmac-sha384-192-aes256
This specification requires implementations to generate random values. The use of inadequate pseudorandom number generators (PRNGs) can result in little or no security. The generation of quality random numbers is difficult. [RFC4086] offers guidance on random number generation.
This document specifies a mechanism for generating keys from passphrases or passwords. The use of PBKDF2, a salt, and a large iteration count adds some resistance to offline dictionary attacks by passive eavesdroppers. Salting prevents "rainbow table" attacks, while large iteration counts slow password-guess attempts. Nonetheless, computing power continues to rapidly improve, including the potential for use of graphics processing units (GPUs) in password-guess attempts. It is important to choose strong passphrases. Use of Kerberos extensions that protect against offline dictionary attacks should also be considered, as should the use of public key cryptography for initial Kerberos authentication [RFC4556] to eliminate the use of passwords or passphrases within the Kerberos protocol.
Jenkins, et al. Informational [Page 8]
RFC 8009 AES-CTS HMAC-SHA2 For Kerberos 5 October 2016
The NIST guidance in Section 5.3 of [SP800-38A], requiring that CBC initialization vectors be unpredictable, is satisfied by the use of a random confounder as the first block of plaintext. The confounder fills the cryptographic role typically played by an initialization vector. This approach was chosen to align with other Kerberos cryptosystem approaches.
The NIST guidance in Section 5.1 of [SP800-132] requires at least 128 bits of the salt to be randomly generated. The string-to-key function as defined in [RFC3961] requires the salt to be valid UTF-8 strings [RFC3629]. Not every 128-bit random string will be valid UTF-8, so a UTF-8-compatible encoding would be needed to encapsulate the random bits. However, using a salt containing a random portion may have the following issues with some implementations:
* Keys for cross-realm krbtgt services [RFC4120] are typically managed by entering the same password at two Key Distribution Centers (KDCs) to get the same keys. If each KDC uses a random salt, they won't have the same keys.
* Random salts may interfere with checking of password history.
This document has been written to be consistent with common implementations of AES and SHA-2. The encryption and hash algorithm sizes have been chosen to create a consistent level of protection, with consideration to implementation efficiencies. So, for instance, SHA-384, which would normally be matched to AES-192, is instead matched to AES-256 to leverage the fact that there are efficient hardware implementations of AES-256. Note that, as indicated by the enc-type name "aes256-cts-hmac-sha384-192", the truncation of the HMAC-SHA-384 output to 192 bits results in an overall 192-bit level of security.
Jenkins, et al. Informational [Page 9]
RFC 8009 AES-CTS HMAC-SHA2 For Kerberos 5 October 2016
[SP800-38A+] National Institute of Standards and Technology, "Recommendation for Block Cipher Modes of Operation: Three Variants of Ciphertext Stealing for CBC Mode", NIST Special Publication 800-38A Addendum, October 2010.
[SP800-108] National Institute of Standards and Technology, "Recommendation for Key Derivation Using Pseudorandom Functions", NIST Special Publication 800-108, October 2009.
Jenkins, et al. Informational [Page 10]
RFC 8009 AES-CTS HMAC-SHA2 For Kerberos 5 October 2016
[SP800-38A] National Institute of Standards and Technology, "Recommendation for Block Cipher Modes of Operation: Methods and Techniques", NIST Special Publication 800-38A, December 2001.
[SP800-132] National Institute of Standards and Technology, "Recommendation for Password-Based Key Derivation, Part 1: Storage Applications", NIST Special Publication 800-132, June 2010.
Jenkins, et al. Informational [Page 11]
RFC 8009 AES-CTS HMAC-SHA2 For Kerberos 5 October 2016