Network Working Group K. Raeburn
Request for Comments: 3962 MIT
Category: Standards Track February 2005
Advanced Encryption Standard (AES) Encryption for Kerberos 5
Status of This Memo
This document specifies an Internet standards track protocol for the
Internet community, and requests discussion and suggestions for
improvements. Please refer to the current edition of the "Internet
Official Protocol Standards" (STD 1) for the standardization state
and status of this protocol. Distribution of this memo is unlimited.
Copyright Notice
Copyright (C) The Internet Society (2005).
Abstract
The United States National Institute of Standards and Technology
(NIST) has chosen a new Advanced Encryption Standard (AES), which is
significantly faster and (it is believed) more secure than the old
Data Encryption Standard (DES) algorithm. This document is a
specification for the addition of this algorithm to the Kerberos
cryptosystem suite.
This document defines encryption key and checksum types for Kerberos
5 using the AES algorithm recently chosen by NIST. These new types
support 128-bit block encryption and key sizes of 128 or 256 bits.
Using the "simplified profile" of [KCRYPTO], we can define a pair of
encryption and checksum schemes. AES is used with ciphertext
stealing to avoid message expansion, and SHA-1 [SHA1] is the
associated checksum function.
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 BCP 14, RFC 2119
[KEYWORDS].
Raeburn Standards Track [Page 1]
RFC 3962 AES Encryption for Kerberos 5 February 2005
The profile in [KCRYPTO] treats keys and random octet strings as
conceptually different. But since the AES key space is dense, we can
use any bit string of appropriate length as a key. We use the byte
representation for the key described in [AES], where the first bit of
the bit string is the high bit of the first byte of the byte string
(octet string) representation.
Given the above format for keys, we can generate keys from the
appropriate amounts of random data (128 or 256 bits) by simply
copying the input string.
To generate an encryption key from a pass phrase and salt string, we
use the PBKDF2 function from PKCS #5 v2.0 ([PKCS5]), with parameters
indicated below, to generate an intermediate key (of the same length
as the desired final key), which is then passed into the DK function
with the 8-octet ASCII string "kerberos" as is done for des3-cbc-
hmac-sha1-kd in [KCRYPTO]. (In [KCRYPTO] terms, the PBKDF2 function
produces a "random octet string", hence the application of the
random-to-key function even though it's effectively a simple identity
operation.) The resulting key is the user's long-term key for use
with the encryption algorithm in question.
tkey = random2key(PBKDF2(passphrase, salt, iter_count, keylength))
key = DK(tkey, "kerberos")
The pseudorandom function used by PBKDF2 will be a SHA-1 HMAC of the
passphrase and salt, as described in Appendix B.1 to PKCS#5.
The number of iterations is specified by the string-to-key parameters
supplied. The parameter string is four octets indicating an unsigned
number in big-endian order. This is the number of iterations to be
performed. If the value is 00 00 00 00, the number of iterations to
be performed is 4,294,967,296 (2**32). (Thus the minimum expressible
iteration count is 1.)
For environments where slower hardware is the norm, implementations
of protocols such as Kerberos may wish to limit the number of
iterations to prevent a spoofed response supplied by an attacker from
consuming lots of client-side CPU time; if such a limit is
implemented, it SHOULD be no less than 50,000. Even for environments
with fast hardware, 4 billion iterations is likely to take a fairly
long time; much larger bounds might still be enforced, and it might
be wise for implementations to permit interruption of this operation
by the user if the environment allows for it.
Raeburn Standards Track [Page 2]
RFC 3962 AES Encryption for Kerberos 5 February 2005
If the string-to-key parameters are not supplied, the value used is
00 00 10 00 (decimal 4,096, indicating 4,096 iterations).
Note that this is not a requirement, nor even a recommendation, for
this value to be used in "optimistic preauthentication" (e.g.,
attempting timestamp-based preauthentication using the user's long-
term key without having first communicated with the KDC) in the
absence of additional information, or as a default value for sites to
use for their principals' long-term keys in their Kerberos database.
It is simply the interpretation of the absence of the string-to-key
parameter field when the KDC has had an opportunity to provide it.
Sample test vectors are given in Appendix B.
Cipher block chaining is used to encrypt messages, with the initial
vector stored in the cipher state. Unlike previous Kerberos
cryptosystems, we use ciphertext stealing to handle the possibly
partial final block of the message.
Ciphertext stealing is described on pages 195-196 of [AC], and
section 8 of [RC5]; it has the advantage that no message expansion is
done during encryption of messages of arbitrary sizes as is typically
done in CBC mode with padding. Some errata for [RC5] are listed in
Appendix A and are considered part of the ciphertext stealing
technique as used here.
Ciphertext stealing, as defined in [RC5], assumes that more than one
block of plain text is available. If exactly one block is to be
encrypted, that block is simply encrypted with AES (also known as ECB
mode). Input smaller than one block is padded at the end to one
block; the values of the padding bits are unspecified.
(Implementations MAY use all-zero padding, but protocols MUST NOT
rely on the result being deterministic. Implementations MAY use
random padding, but protocols MUST NOT rely on the result not being
deterministic. Note that in most cases, the Kerberos encryption
profile will add a random confounder independent of this padding.)
For consistency, ciphertext stealing is always used for the last two
blocks of the data to be encrypted, as in [RC5]. If the data length
is a multiple of the block size, this is equivalent to plain CBC mode
with the last two ciphertext blocks swapped.
A test vector is given in Appendix B.
Raeburn Standards Track [Page 3]
RFC 3962 AES Encryption for Kerberos 5 February 2005
The initial vector carried out from one encryption for use in a
subsequent encryption is the next-to-last block of the encryption
output; this is the encrypted form of the last plaintext block. When
decrypting, the next-to-last block of the supplied ciphertext is
carried forward as the next initial vector. If only one ciphertext
block is available (decrypting one block, or encrypting one block or
less), then that one block is carried out instead.
This is a summary of the parameters to be used with the simplified
algorithm profile described in [KCRYPTO]:
+--------------------------------------------------------------------+
| protocol key format 128- or 256-bit string |
| |
| string-to-key function PBKDF2+DK with variable |
| iteration count (see |
| above) |
| |
| default string-to-key parameters 00 00 10 00 |
| |
| key-generation seed length key size |
| |
| random-to-key function identity function |
| |
| hash function, H SHA-1 |
| |
| HMAC output size, h 12 octets (96 bits) |
| |
| message block size, m 1 octet |
| |
| encryption/decryption functions, AES in CBC-CTS mode |
| E and D (cipher block size 16 |
| octets), with next-to- |
| last block (last block |
| if only one) as CBC-style |
| ivec |
+--------------------------------------------------------------------+
Using this profile with each key size gives us two each of encryption
and checksum algorithm definitions.
Raeburn Standards Track [Page 4]
RFC 3962 AES Encryption for Kerberos 5 February 2005
The following encryption type numbers are assigned:
+--------------------------------------------------------------------+
| encryption types |
+--------------------------------------------------------------------+
| type name etype value key size |
+--------------------------------------------------------------------+
| aes128-cts-hmac-sha1-96 17 128 |
| aes256-cts-hmac-sha1-96 18 256 |
+--------------------------------------------------------------------+
The following checksum type numbers are assigned:
+--------------------------------------------------------------------+
| checksum types |
+--------------------------------------------------------------------+
| type name sumtype value length |
+--------------------------------------------------------------------+
| hmac-sha1-96-aes128 15 96 |
| hmac-sha1-96-aes256 16 96 |
+--------------------------------------------------------------------+
These checksum types will be used with the corresponding encryption
types defined above.
This new algorithm has not been around long enough to receive the
decades of intense analysis that DES has received. It is possible
that some weakness exists that has not been found by the
cryptographers analyzing these algorithms before and during the AES
selection process.
The use of the HMAC function has drawbacks for certain pass phrase
lengths. For example, a pass phrase longer than the hash function
block size (64 bytes, for SHA-1) is hashed to a smaller size (20
bytes) before applying the main HMAC algorithm. However, entropy is
generally sparse in pass phrases, especially in long ones, so this
may not be a problem in the rare cases of users with long pass
phrases.
Also, generating a 256-bit key from a pass phrase of any length may
be deceptive, as the effective entropy in pass-phrase-derived key
cannot be nearly that large given the properties of the string-to-key
function described here.
Raeburn Standards Track [Page 5]
RFC 3962 AES Encryption for Kerberos 5 February 2005
The iteration count in PBKDF2 appears to be useful primarily as a
constant multiplier for the amount of work required for an attacker
using brute-force methods. Unfortunately, it also multiplies, by the
same amount, the work needed by a legitimate user with a valid
password. Thus the work factor imposed on an attacker (who may have
many powerful workstations at his disposal) must be balanced against
the work factor imposed on the legitimate user (who may have a PDA or
cell phone); the available computing power on either side increases
as time goes on, as well. A better way to deal with the brute-force
attack is through preauthentication mechanisms that provide better
protection of the user's long-term key. Use of such mechanisms is
out of the scope of this document.
If a site does wish to use this means of protection against a brute-
force attack, the iteration count should be chosen based on the
facilities available to both attacker and legitimate user, and the
amount of work the attacker should be required to perform to acquire
the key or password.
As an example:
The author's tests on a 2GHz Pentium 4 system indicated that in
one second, nearly 90,000 iterations could be done, producing a
256-bit key. This was using the SHA-1 assembly implementation
from OpenSSL, and a pre-release version of the PBKDF2 code for
MIT's Kerberos package, on a single system. No attempt was made
to do multiple hashes in parallel, so we assume an attacker doing
so can probably do at least 100,000 iterations per second --
rounded up to 2**17, for ease of calculation. For simplicity, we
also assume the final AES encryption step costs nothing.
Paul Leach estimates [LEACH] that a password-cracking dictionary
may have on the order of 2**21 entries, with capitalization,
punctuation, and other variations contributing perhaps a factor of
2**11, giving a ballpark estimate of 2**32.
Thus, for a known iteration count N and a known salt string, an
attacker with some number of computers comparable to the author's
would need roughly N*2**15 CPU seconds to convert the entire
dictionary plus variations into keys.
An attacker using a dozen such computers for a month would have
roughly 2**25 CPU seconds available. So using 2**12 (4,096)
iterations would mean an attacker with a dozen such computers
dedicated to a brute-force attack against a single key (actually,
any password-derived keys sharing the same salt and iteration
Raeburn Standards Track [Page 6]
RFC 3962 AES Encryption for Kerberos 5 February 2005
count) would process all the variations of the dictionary entries
in four months and, on average, would likely find the user's
password in two months.
Thus, if this form of attack is of concern, users should be
required to change their passwords every few months, and an
iteration count a few orders of magnitude higher should be chosen.
Perhaps several orders of magnitude, as many users will tend to
use the shorter and simpler passwords (to the extent they can,
given a site's password quality checks) that the attacker would
likely try first.
Since this estimate is based on currently available CPU power, the
iteration counts used for this mode of defense should be increased
over time, at perhaps 40%-60% each year or so.
Note that if the attacker has a large amount of storage available,
intermediate results could be cached, saving a lot of work for the
next attack with the same salt and a greater number of iterations
than had been run at the point where the intermediate results were
saved. Thus, it would be wise to generate a new random salt
string when passwords are changed. The default salt string,
derived from the principal name, only protects against the use of
one dictionary of keys against multiple users.
If the PBKDF2 iteration count can be spoofed by an intruder on the
network, and the limit on the accepted iteration count is very high,
the intruder may be able to introduce a form of denial of service
attack against the client by sending a very high iteration count,
causing the client to spend a great deal of CPU time computing an
incorrect key.
An intruder spoofing the KDC reply, providing a low iteration count
and reading the client's reply from the network, may be able to
reduce the work needed in the brute-force attack outlined above.
Thus, implementations may seek to enforce lower bounds on the number
of iterations that will be used.
Since threat models and typical end-user equipment will vary widely
from site to site, allowing site-specific configuration of such
bounds is recommended.
Any benefit against other attacks specific to the HMAC or SHA-1
algorithms is probably achieved with a fairly small number of
iterations.
Raeburn Standards Track [Page 7]
RFC 3962 AES Encryption for Kerberos 5 February 2005
In the "optimistic preauthentication" case mentioned in section 3,
the client may attempt to produce a key without first communicating
with the KDC. If the client has no additional information, it can
only guess as to the iteration count to be used. Even such
heuristics as "iteration count X was used to acquire tickets for the
same principal only N hours ago" can be wrong. Given the
recommendation above for increasing the iteration counts used over
time, it is impossible to recommend any specific default value for
this case; allowing site-local configuration is recommended. (If the
lower and upper bound checks described above are implemented, the
default count for optimistic preauthentication should be between
those bounds.)
Ciphertext stealing mode, as it requires no additional padding in
most cases, will reveal the exact length of each message being
encrypted rather than merely bounding it to a small range of possible
lengths as in CBC mode. Such obfuscation should not be relied upon
at higher levels in any case; if the length must be obscured from an
outside observer, this should be done by intentionally varying the
length of the message to be encrypted.
Kerberos encryption and checksum type values used in section 7 were
previously reserved in [KCRYPTO] for the mechanisms defined in this
document. The registries have been updated to list this document as
the reference.
Thanks to John Brezak, Gerardo Diaz Cuellar, Ken Hornstein, Paul
Leach, Marcus Watts, Larry Zhu, and others for feedback on earlier
versions of this document.
Raeburn Standards Track [Page 8]
RFC 3962 AES Encryption for Kerberos 5 February 2005
(Copied from the RFC Editor's errata web site on July 8, 2004.)
Reported By: Bob Baldwin; baldwin@plusfive.com
Date: Fri, 26 Mar 2004 06:49:02 -0800
In Section 8, Description of RC5-CTS, of the encryption method,
it says:
1. Exclusive-or Pn-1 with the previous ciphertext
block, Cn-2, to create Xn-1.
It should say:
1. Exclusive-or Pn-1 with the previous ciphertext
block, Cn-2, to create Xn-1. For short messages where
Cn-2 does not exist, use IV.
Reported By: Bob Baldwin; baldwin@plusfive.com
Date: Mon, 22 Mar 2004 20:26:40 -0800
In Section 8, first paragraph, second sentence says:
This mode handles any length of plaintext and produces ciphertext
whose length matches the plaintext length.
In Section 8, first paragraph, second sentence should read:
This mode handles any length of plaintext longer than one
block and produces ciphertext whose length matches the
plaintext length.
In Section 8, step 6 of the decryption method says:
6. Decrypt En to create Pn-1.
In Section 8, step 6 of the decryption method should read:
6. Decrypt En and exclusive-or with Cn-2 to create Pn-1.
For short messages where Cn-2 does not exist, use the IV.
Raeburn Standards Track [Page 9]
RFC 3962 AES Encryption for Kerberos 5 February 2005