 1/draftietfkittenaesctshmacsha200.txt 20130629 19:14:56.632863606 +0100
+++ 2/draftietfkittenaesctshmacsha201.txt 20130629 19:14:56.664864364 +0100
@@ 1,19 +1,19 @@
Network Working Group K. Burgin
Internet Draft National Security Agency
Intended Status: Informational M. Peck
Expires: October 21, 2013 The MITRE Corporation
 April 19, 2013
+Expires: December 30, 2013 The MITRE Corporation
+ June 28, 2013
AES Encryption with HMACSHA2 for Kerberos 5
 draftietfkittenaesctshmacsha200
+ draftietfkittenaesctshmacsha201
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 SHA2 hash for integrity.
Status of this Memo
@@ 23,419 +23,470 @@
InternetDrafts are working documents of the Internet Engineering
Task Force (IETF). Note that other groups may also distribute
working documents as InternetDrafts. The list of current Internet
Drafts is at http://datatracker.ietf.org/drafts/current/.
InternetDrafts are draft documents valid for a maximum of six months
and may be updated, replaced, or obsoleted by other documents at any
time. It is inappropriate to use InternetDrafts as reference
material or to cite them other than as "work in progress."
 This InternetDraft will expire on October 21, 2013.
+ This InternetDraft will expire on December 30, 2013.
Copyright and License Notice
Copyright (c) 2013 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/licenseinfo) 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.
Table of Contents
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 3
 2. Conventions used in this Document . . . . . . . . . . . . . . 3
 3. Protocol Key Representation . . . . . . . . . . . . . . . . . 3
 4. Key Generation from Pass Phrases . . . . . . . . . . . . . . . 3
 5. Key Derivation Function . . . . . . . . . . . . . . . . . . . 4
 6. Kerberos Algorithm Protocol Parameters . . . . . . . . . . . . 5
 7. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 8
 8. Security Considerations . . . . . . . . . . . . . . . . . . . 8
 9. References . . . . . . . . . . . . . . . . . . . . . . . . . . 9
 9.1. Normative References . . . . . . . . . . . . . . . . . . . 9
 9.2. Informative References . . . . . . . . . . . . . . . . . . 9
 Appendix A. Test Vectors . . . . . . . . . . . . . . . . . . . . 10
 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 12
+ 2. Protocol Key Representation . . . . . . . . . . . . . . . . . 3
+ 3. Key Generation from Pass Phrases . . . . . . . . . . . . . . . 3
+ 4. Key Derivation Function . . . . . . . . . . . . . . . . . . . 4
+ 5. Kerberos Algorithm Protocol Parameters . . . . . . . . . . . . 5
+ 6. Checksum Parameters . . . . . . . . . . . . . . . . . . . . . 8
+ 7. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 9
+ 8. Security Considerations . . . . . . . . . . . . . . . . . . . 9
+ 8.1. Random Values in Salt Strings . . . . . . . . . . . . . . 9
+ 9. References . . . . . . . . . . . . . . . . . . . . . . . . . . 10
+ 9.1. Normative References . . . . . . . . . . . . . . . . . . . 10
+ 9.2. Informative References . . . . . . . . . . . . . . . . . . 10
+ Appendix A. Test Vectors . . . . . . . . . . . . . . . . . . . . 11
+ Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 15
1. Introduction
This document defines two encryption types and two corresponding
checksum types for Kerberos 5 using AES with 128bit or 256bit keys.
 The new types conform to the framework specified in [RFC3961], but do
 not use the simplified profile.
+ To avoid ciphertext expansion, we use the CBCCS3 variant to CBC mode
+ defined in [SP80038A+] (this mode is also referred to as CTS). The
+ new types conform to the framework specified in [RFC3961], but do not
+ use the simplified profile.
 The new encryption types use AES in CTS mode (CBC mode with
 ciphertext stealing) similar to [RFC3962] but with several
 variations.
+ Note that [SP80038A+] requires the plaintext length to be greater
+ than the block size, so the encryption types have two cases.
 The new types use the PBKDF2 algorithm for key generation from
 strings, with a modification to the use in [RFC3962] that the
 pseudorandom function used by PBKDF2 is HMACSHA256 or HMACSHA384
 instead of HMACSHA1.
+ The encryption and checksum types defined in this document are
+ intended to support NSA's Suite B Profile for Kerberos [suiteb
+ kerberos] which requires the use of SHA256 or SHA384 as the hash
+ algorithm. Differences between the encryption and checksum types
+ defined in this document and existing Kerberos encryption and
+ checksum types are:
 The new types use key derivation to produce keys for encryption,
 integrity protection, and checksum operations as in [RFC3962].
 However, a key derivation function from [SP800108] which uses the
 SHA256 or SHA384 hash algorithm is used in place of the DK key
 derivation function used in [RFC3961].
+ * The pseudorandom function used by PBKDF2 is HMACSHA256 or HMAC
+ SHA384.
 The new types use the HMAC algorithm with a hash from the SHA2
 family for integrity protection and checksum operations.
+ * A key derivation function from [SP800108] which uses the SHA256
+ or SHA384 hash algorithm is used to produce keys for encryption,
+ integrity protection, and checksum operations.
2. Conventions used in this Document
+ * The IV used during content encryption is sent as part of the
+ ciphertext, instead of using a confounder. This saves one
+ encryption and decryption operation per message.
 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 RFC 2119 [RFC2119].
+ * The HMAC is calculated over the AES output, instead of being
+ calculated over the plaintext. This allows the message receiver
+ to verify the integrity of the message before decrypting the
+ message.
3. Protocol Key Representation
+ * The HMAC algorithm uses the SHA256 or SHA384 hash algorithm for
+ integrity protection and checksum operations.
+
+2. Protocol Key Representation
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).
4. Key Generation from Pass Phrases

 We use a variation on the key generation algorithm specified in
 Section 4 of [RFC3962] with the following changes:

 * The pseudorandom function used by PBKDF2 will be the SHA256 or
 SHA384 HMAC of the passphrase and salt, instead of the SHA1 HMAC
 of the passphrase and salt. If the enctype is "aes128ctshmac
 sha256128", then HMACSHA256 is used as the PRF. If the enctype
 is "aes256ctshmacsha384192", then HMACSHA384 is used as the
 PRF.
+3. Key Generation from Pass Phrases
 * The salt MUST contain at least 128 random bits as required in
 Section 5.1 of [SP800132]. It MAY also contain other information
 such as the principal's realm and name components.
+ The pseudorandom function used by PBKDF2 will be the SHA256 or SHA
+ 384 HMAC of the passphrase and salt. If the enctype is "aes128cts
+ hmacsha256128", then HMACSHA256 is used as the PRF. If the
+ enctype is "aes256ctshmacsha384192", then HMACSHA384 is used as
+ the PRF.
 * The final key derivation step uses the algorithm KDFHMACSHA2
 defined below in Section 5 instead of the DK function.
+ The final key derivation step uses the algorithm KDFHMACSHA2
+ defined below in Section 4.
 * If no stringtokey parameters are specified, the default number
 of iterations is raised to 32,768.
+ If no stringtokey parameters are specified, the default number of
+ iterations is raised to 32,768.
To ensure that different longterm keys are used with different
enctypes, we prepend the enctype name to the salt string, separated
by a null byte. The enctype name is "aes128ctshmacsha256128" or
"aes256ctshmacsha384192" (without the quotes). The user's long
term key is derived as follows
saltp = enctypename  0x00  salt
tkey = randomtokey(PBKDF2(passphrase, saltp,
iter_count, keylength))
key = KDFHMACSHA2(tkey, "kerberos") where "kerberos" is the
byte string {0x6b65726265726f73}.
where the pseudorandom function used by PBKDF2 is HMACSHA256 when
the enctype is "aes128ctshmacsha256128" and HMACSHA384 when the
enctype is "aes256ctshmacsha384192", the value for keylength is
the AES key length, and the algorithm KDFHMACSHA2 is defined in
 Section 5.
+ Section 4.
5. Key Derivation Function
+4. Key Derivation Function
We use a key derivation function from Section 5.1 of [SP800108]
which uses the HMAC algorithm as the PRF. The counter i is expressed
as four octets in bigendian order. The length of the output key in
bits (denoted as k) is also represented as four octets in bigendian
order. The "Label" input to the KDF is the usage constant supplied
 to the key derivation function, and the "Context" input is null. In
 the following summary,  indicates concatenation. The randomtokey
 function is the identity function, as defined in Section 6. The k
 truncate function is defined in [RFC3961], Section 5.1.
+ to the key derivation function, and the "Context" input is null.
+ Each application of the KDF only requires a single iteration of the
+ PRF, so n = 1 in the notation of [SP800108].
+
+ In the following summary,  indicates concatenation. The randomto
+ key function is the identity function, as defined in Section 3. The
+ ktruncate function is defined in [RFC3961], Section 5.1.
When the encryption type is aes128ctshmacsha256128, the output
key length k is 128 bits for all applications of KDFHMACSHA2(key,
constant) which is computed as follows:
 n = 1
K1 = HMACSHA256(key, 00 00 00 01  constant  0x00  00 00 00 80)
 DR(key, constant) = ktruncate(K1)
 KDFHMACSHA2(key, constant) = randomtokey(DR(key, constant))
+ KDFHMACSHA2(key, constant) = randomtokey(ktruncate(K1))
When the encryption type is aes256ctshmacsha384192, the output
key length k is 256 bits when computing the basekey and Ke, and the
output key length k is 192 bits when deriving Kc and Ki. KDFHMAC
SHA2(key, constant) is computed as follows:
If deriving Kc or Ki (the constant ends with 0x99 or 0x55):
k = 192
 n = 1
K1 = HMACSHA384(key, 00 00 00 01  constant  0x00  00 00 00 C0)
 DR(key, constant) = ktruncate(K1)
 KDFHMACSHA2(key, constant) = randomtokey(DR(key, constant))
+ KDFHMACSHA2(key, constant) = randomtokey(ktruncate(K1))
Otherwise (if deriving Ke or deriving the basekey from a
 passphrase as described in Section 4):
+ passphrase as described in Section 3):
k = 256
 n = 1
K1 = HMACSHA384(key, 00 00 00 01  constant  0x00  00 00 01 00)
 DR(key, constant) = ktruncate(K1)
 KDFHMACSHA2(key, constant) = randomtokey(DR(key, constant))
+ KDFHMACSHA2(key, constant) = randomtokey(ktruncate(K1))
The constants used for key derivation are the same as those used in
the simplified profile.
6. Kerberos Algorithm Protocol Parameters

 The following parameters apply to the encryption types aes128cts
 hmacsha256128 and aes256ctshmacsha384192.
+5. Kerberos Algorithm Protocol Parameters
 The keyderivation function described in the previous section is used
 to produce the three intermediate keys. Typically, CBC mode [SP800
 38A] requires the input be padded to a multiple of the encryption
 algorithm block size, which is 128 bits for AES. However, to avoid
 ciphertext expansion, we use the CBCCS3 variant to CBC mode defined
 in [SP80038A+] (this mode is also referred to as CTS). Note that
 [SP80038A+] requires the plaintext length to be greater than or
 equal to the block size.
+ In cases where the plaintext length is greater than the block size:
 Each encryption will use a freshly generated 16octet nonce generated
 at random by the message originator. The initialization vector (IV)
 used by AES is obtained by xoring the random nonce with the
 cipherstate.
+ Each encryption will use a 16octet nonce generated at random by
+ the message originator. The initialization vector (IV) used by
+ AES is obtained by xoring the random nonce with the cipherstate.
 The ciphertext is the concatenation of the random nonce, the output
 of AES in CBCCS3 mode, and the HMAC of the nonce concatenated with
 the AES output. The HMAC is computed using either SHA256 or SHA
 384. The output of SHA256 is truncated to 128 bits and the output
 of SHA384 is truncated to 192 bits. Sample test vectors are given in
 Appendix A.
+ The ciphertext is the concatenation of the random nonce, the
+ output of AES in CBCCS3 mode, and the HMAC of the nonce
+ concatenated with the AES output. The HMAC is computed using
+ either SHA256 or SHA384. The output of SHA256 is truncated to
+ 128 bits and the output of SHA384 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 remainder, and then decrypting the remainder if the HMAC
 is correct.
+ against the remainder, and then decrypting the remainder if the
+ HMAC is correct.
 The encryption and checksum mechanisms below use the following
 notation from [RFC3961].
+ In cases where the plaintext length is less than or equal to the
+ block size, a different algorithm is specified.
 HMAC output size, h
 message block size, m
 encryption/decryption functions, E and D
 cipher block size, c
+ Each encryption will use a 16octet nonce generated at random by
+ the message originator. The initialization vector (IV) used by
+ AES is obtained by xoring the random nonce with the cipherstate.
 Encryption Mechanism for AESCTSHMACSHA2

+ The plaintext is padded with zeros so the length of the result is
+ one block length (no zeros are added if the plaintext length
+ equals the block length). The padded plaintext is xored with the
+ IV, then encrypted using AES in ECB mode. The output of AES is
+ split into two parts, so that the length of the first part equals
+ the length of the unpadded plaintext. The nonce is also split
+ into two parts, so that the length of the first part equals the
+ length of the unpadded plaintext.
protocol key format 128 or 256bit string
+ The ciphertext is the concatenation of the first part of the
+ random nonce, the second part of the AES output followed by the
+ first part of the AES output, and the HMAC of the concatenation of
+ the first part of the random nonce, the second part of the AES
+ output followed by the first part of the AES output. The HMAC is
+ computed using either SHA256 or SHA384. The output of SHA256
+ is truncated to 128 bits and the output of SHA384 is truncated to
+ 192 bits. Sample test vectors are given in Appendix A.
specific key structure Three protocolformat keys: { Kc, Ke, Ki }.
+ Decryption is performed by first removing the HMAC, and verifying
+ the HMAC against the remainder. If the HMAC is correct, separate
+ the remainder into N' and C' by taking the first 16 bytes as N',
+ and the following bytes as C'. Split N' into two parts, so that
+ the length of the first part equals the length of C'. Decrypt the
+ concatenation of C' with the second part of N' using ECB mode to
+ get a value P' whose length is one block length. The nonce is
+ recovered by taking the concatenation of the first part of N' with
+ the second part of P' xored with the cipherState (where again, the
+ length of the first part equals the length of C'). The IV is
+ recovered as the nonce xored with cipherState, and the plaintext
+ is recovered as the first part of P' xored with the IV.
required checksum As defined below.
mechanism
+ The following parameters apply to the encryption types aes128cts
+ hmacsha256128 and aes256ctshmacsha384192.
keygeneration seed key size (128 or 256 bits)
length
+ protocol key format: as defined in Section 2.
cipher state Random nonce of length c (128 bits)
+ specific key structure: three protocolformat keys: { Kc, Ke, Ki }.
initial cipher state All bits zero
+ required checksum mechanism: as defined in Section 6.
encryption function N = random nonce of length c (128 bits)
 IV = N + cipherState (+ denotes XOR)
 C = E(Ke, plaintext, IV)
 using CBCCS3Encrypt defined
 in [SP80038A+]
 H = HMAC(Ki, N  C)
 ciphertext = N  C  H[1..h]
 cipherState = N
+ keygeneration seed length: key size (128 or 256 bits).
decryption function (N, C, H) = ciphertext
 if (H != HMAC(Ki, N  C)[1..h])
 stop, report error
 IV = N + cipherState (+ denotes XOR)
 P = D(Ke, C, IV)
 using CBCCS3Decrypt defined
 in [SP80038A+]
 cipherState = N
+ stringtokey function: as defined in Section 3.
pseudorandom function Kp = KDFHMACSHA2(protocolkey, "prf")
 PRF = HMAC(Kp, octetstring)
+ default stringtokey parameters: 00 00 80 00.
key generation functions:
+ randomtokey function: identity function.
stringtokey function tkey = randomtokey(PBKDF2(passphrase, saltp,
 iter_count,
 keylength))
 basekey = KDFHMACSHA2(tkey, "kerberos")
+ keyderivation function: KDFHMACSHA2 as defined in Section 4. The
+ key usage number is expressed as four octets in bigendian order.
 where the pseudorandom function used by PBKDF2
 is HMACSHA256 or HMACSHA384 as described
 in Section 4.
+ Kc = KDFHMACSHA2(basekey, usage  0x99)
+ Ke = KDFHMACSHA2(basekey, usage  0xAA)
+ Ki = KDFHMACSHA2(basekey, usage  0x55)
default stringtokey 00 00 80 00
parameters
+ cipherState: a 128bit random nonce.
randomtokey function identity function
+ initial cipherState: all bits zero.
keyderivation function KDFHMACSHA2 as defined in Section 5. The
 key usage number is expressed as four octets
 in bigendian order.
+ encryption function: as follows. When the plaintext length is
+ greater than the block size, CTS mode is used. When the plaintext
+ is less than or equal to the block size, ECB mode is used.
 Kc = KDFHMACSHA2(basekey, usage  0x99)
 Ke = KDFHMACSHA2(basekey, usage  0xAA)
 Ki = KDFHMACSHA2(basekey, usage  0x55);
+ h = size of truncated HMAC
+ E() = encryption function
+ D() = decryption function
+ c = block size of the encryption algorithm
+ L(x) = length of x
+ < = lessthan operator; true == 1, false == 0
+ zeroblock = one block (length c) of zeros
+ o[start:len] = substring operation returning the substring of
+ length len of string o starting at byte start
+ (zerobased)
 Checksum Mechanism for AESCTSHMACSHA2

associated cryptosystem AES128CTS or AES256CTS as appropriate
+ encryption function:
+ N = random nonce of length 128 bits
+ IV = N XOR cipherState
+ if (L(P) > c)
+ PC = 0
+ P' = P
+ C = E(Ke, P', IV)
+ // using CBCCS3Encrypt defined
+ // in [SP80038A+]
+ N' = N
+ C' = C
+ else
+ PC = c  L(P)
+ P' = P  zeroblock[0:PC]
+ C = E(Ke, P' XOR IV)
+ // using ECB mode
+ N' = N[0:c  PC]  C[c  PC:PC]
+ C' = C[0:c  PC]
+ H = HMAC(Ki, N'  C')
+ ciphertext = N'  C'  H[1..h]
+ cipherState = N
get_mic HMAC(Kc, message)[1..h]
+ decryption function:
+ (N', C', H) = ciphertext
+ if (H != HMAC(Ki, N'  C')[1..h])
+ stop, report error
verify_mic get_mic and compare
+ if (L(C') > c)
+ // Not shortplaintext
+ IV = N' XOR cipherState
+ P = D(Ke, C', IV)
+ // using CBCCS3Decrypt defined
+ // in [SP80038A+]
+ cipherState = N'
+ stop, output P, success
+ else
+ // Short plaintext
+ PC = c  L(C')
+ C = C'  N'[c  PC:PC]
+ P' = D(Ke, C)
+ // using ECB mode
 Using this profile with each key size gives us two each of encryption
 and checksum algorithm definitions.
+ // P' here == (P  zeroblock[0:PC]) XOR IV
+ // so IV[c  PC:PC] == P'[c  PC:PC]
+ // In the nonshortpt case we'd recover
+ // IV as N XOR cipherState, but here we only know
+ // a head of N and tail of IV.
 ++
  encryption types 
 ++
  type name etype value key size 
 ++
  aes128ctshmacsha256128 TBD1 128 
  aes256ctshmacsha384192 TBD2 256 
 ++
+ N = N'[0:c PC]  (P' XOR cipherState)[c  PC:PC]
+ IV = N XOR cipherState
+ P = (P' XOR IV)[0:PC]
+ cipherState = N
+ stop, output P, success
 ++
  checksum types 
 ++
  type name sumtype value length 
 ++
  hmacsha256128aes128 TBD3 128 
  hmacsha384192aes256 TBD4 192 
 ++
+ pseudorandom function:
+ Kp = KDFHMACSHA2(protocolkey, "prf")
+ PRF = HMAC(Kp, octetstring)
 These checksum types will be used with the corresponding encryption
 types defined above.
+6. Checksum Parameters
+
+ The following parameters apply to the checksum types hmacsha256128
+ aes128 and hmacsha384192aes256, which are the associated checksums
+ for aes128ctshmacsha256128 and aes256ctshmacsha384192,
+ respectively.
+
+ associated cryptosystem: AES128CTS or AES256CTS as appropriate
+
+ get_mic: HMAC(Kc, message)[1..h]
+
+ verify_mic: get_mic and compare
7. IANA Considerations
IANA is requested to assign:
 1. Encryption type numbers for aes128ctshmacsha256128 and
 aes256ctshmacsha384192 in the Kerberos Encryption Type
 Numbers registry.
+ Encryption type numbers for aes128ctshmacsha256128 and
+ aes256ctshmacsha384192 in the Kerberos Encryption Type Numbers
+ registry.
Etype encryption type Reference
  
TBD1 aes128ctshmacsha256128 [this document]
TBD2 aes256ctshmacsha384192 [this document]
 2. Checksum type numbers for hmacsha256128aes128 and
 hmacsha384192aes256 in the Kerberos Checksum Type Numbers
 registry.
+ Checksum type numbers for hmacsha256128aes128 and hmacsha384192
+ aes256 in the Kerberos Checksum Type Numbers registry.
Sumtype Checksum type Size Reference
   
TBD3 hmacsha256128aes128 16 [this document]
TBD4 hmacsha384192aes256 24 [this document]
8. Security Considerations
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. NIST Special Publication 80090
[SP80090] and [RFC4086] offer random number generation guidance.
This document specifies a mechanism for generating keys from pass
phrases or passwords. The salt and iteration count resist brute
force and dictionary attacks, however, it is still important to
choose or generate strong passphrases.
9. References
+8.1. Random Values in Salt Strings
9.1. Normative References
+ NIST guidance in Section 5.1 of [SP800132] requires the salt used as
+ input to the PBKDF to contain at least 128 bits of random. Some
+ known issues with including random values in Kerberos encryption type
+ salt strings are:
 [SP80038A+] National Institute of Standards and Technology,
 "Recommendation for Block Cipher Modes of Operation:
 Three Variants of Ciphertext Stealing for CBC Mode",
 Addendum to NIST Special Publication 80038A, October
 2010.
+ * Crossrealm TGTs are currently managed by entering the same
+ password at two KDCs to get the same keys. If each KDC uses a
+ random salt, they won't have the same keys.
 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
 Requirement Levels", BCP 14, RFC 2119, March 1997.
+ * The stringtokey function as defined in [RFC3961] requires the
+ salt to be valid UTF8 strings. Not every 128bit random string
+ will be valid UTF8.
+
+ * Current implementations of password history checking will not
+ work.
+
+ * ktutil's add_entry command assumes the default salt.
+
+9. References
+
+9.1. Normative References
[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 3rd, D., Schiller, J., and S. Crocker,
"Randomness Requirements for Security", BCP 106,
RFC 4086, June 2005.
[FIPS197] National Institute of Standards and Technology,
"Advanced Encryption Standard (AES)", FIPS PUB 197,
November 2001.
9.2. Informative References
 [SP80038A] National Institute of Standards and Technology,
 "Recommendation for Block Cipher Modes of Operation 
 Methods and Techniques", NIST Special Publication 800
 38A, February 2001.
+ [SP80038A+] National Institute of Standards and Technology,
+ "Recommendation for Block Cipher Modes of Operation:
+ Three Variants of Ciphertext Stealing for CBC Mode",
+ Addendum to NIST Special Publication 80038A, October
+ 2010.
[SP80090] National Institute of Standards and Technology,
Recommendation for Random Number Generation Using
Deterministic Random Bit Generators (Revised), NIST
Special Publication 80090, March 2007.
[SP800108] National Institute of Standards and Technology,
"Recommendation for Key Derivation Using Pseudorandom
Functions", NIST Special Publication 800108, October
2009.
[SP800132] National Institute of Standards and Technology,
"Recommendation for PasswordBased Key Derivation, Part
1: Storage Applications", NIST Special Publication 800
132, June 2010.
+ [suitebkerberos]
+ Burgin, K. and K. Igoe, "Suite B Profile for
+ Kerberos 5", internetdraft draftburginkerberos
+ suiteb01, 2012.
+
Appendix A. Test Vectors
Sample results for stringtokey conversion:
+ 
Iteration count = 32768
Pass phrase = "password"
Saltp for creating 128bit master key:
61 65 73 31 32 38 2D 63 74 73 2D 68 6D 61 63 2D
 73 68 61 32 35 36 2D 31 32 38 00 F3 60 61 DC E2
 E1 B3 59 00 83 87 46 B8 78 2F 1D 41 54 48 45 4E
+ 73 68 61 32 35 36 2D 31 32 38 00 10 DF 9D D7 83
+ E5 BC 8A CE A1 73 0E 74 35 5F 61 41 54 48 45 4E
41 2E 4D 49 54 2E 45 44 55 72 61 65 62 75 72 6E
(The saltp is "aes128ctshmacsha256128"  0x00 
 16 random bytes  "ATHENA.MIT.EDUraeburn")
+ random 16 byte valid UTF8 sequence  "ATHENA.MIT.EDUraeburn")
128bit master key:
 37 05 D9 60 80 C1 77 28 A0 E8 00 EA B6 E0 D2 3C
+ 3C 44 03 85 28 06 BF 5C EE E6 36 48 6C 29 2F D6
Saltp for creating 256bit master key:
61 65 73 32 35 36 2D 63 74 73 2D 68 6D 61 63 2D
 73 68 61 33 38 34 2D 31 39 32 00 F3 60 61 DC E2
 E1 B3 59 00 83 87 46 B8 78 2F 1D 41 54 48 45 4E
+ 73 68 61 33 38 34 2D 31 39 32 00 10 DF 9D D7 83
+ E5 BC 8A CE A1 73 0E 74 35 5F 61 41 54 48 45 4E
41 2E 4D 49 54 2E 45 44 55 72 61 65 62 75 72 6E
(The saltp is "aes256ctshmacsha384192"  0x00 
 16 random bytes  "ATHENA.MIT.EDUraeburn")
+ random 16 byte valid UTF8 sequence  "ATHENA.MIT.EDUraeburn")
256bit master key:
 6D 40 4D 37 FA F7 9F 9D F0 D3 35 68 D3 20 66 98
 00 EB 48 36 47 2E A8 A0 26 D1 6B 71 82 46 0C 52
+ 53 96 0C AF 44 D5 57 4D FF 4D 44 37 38 75 22 B0
+ 7F 5B 02 5C 5E 65 BF EF 29 C2 B4 28 98 3B 37 08
Sample results for key derivation:
+ 
enctype aes128ctshmacsha256128:
128bit master key:
37 05 D9 60 80 C1 77 28 A0 E8 00 EA B6 E0 D2 3C
Kc value for key usage 2 (constant = 0x0000000299):
B3 1A 01 8A 48 F5 47 76 F4 03 E9 A3 96 32 5D C3
Ke value for key usage 2 (constant = 0x00000002AA):
9B 19 7D D1 E8 C5 60 9D 6E 67 C3 E3 7C 62 C7 2E
Ki value for key usage 2 (constant = 0x0000000255):
9F DA 0E 56 AB 2D 85 E1 56 9A 68 86 96 C2 6A 6C
@@ 440,68 +491,167 @@
Ki value for key usage 2 (constant = 0x0000000255):
9F DA 0E 56 AB 2D 85 E1 56 9A 68 86 96 C2 6A 6C
enctype aes256ctshmacsha384192:
256bit master key:
6D 40 4D 37 FA F7 9F 9D F0 D3 35 68 D3 20 66 98
00 EB 48 36 47 2E A8 A0 26 D1 6B 71 82 46 0C 52
Kc value for key usage 2 (constant = 0x0000000299):
EF 57 18 BE 86 CC 84 96 3D 8B BB 50 31 E9 F5 C4
BA 41 F2 8F AF 69 E7 3D
+
Ke value for key usage 2 (constant = 0x00000002AA):
56 AB 22 BE E6 3D 82 D7 BC 52 27 F6 77 3F 8E A7
A5 EB 1C 82 51 60 C3 83 12 98 0C 44 2E 5C 7E 49
Ki value for key usage 2 (constant = 0x0000000255):
69 B1 65 14 E3 CD 8E 56 B8 20 10 D5 C7 30 12 B6
22 C4 D0 0F FC 23 ED 1F
Sample encryptions (using the default cipher state):
+ 
 128bit master key:
 37 05 D9 60 80 C1 77 28 A0 E8 00 EA B6 E0 D2 3C
 128bit AES key (Ke, key usage 2):
+ 128bit AES key:
+ 2B 7E 15 16 28 AE D2 A6 AB F7 15 88 09 CF 4F 3C
+ 128bit HMAC key:
+ 67 C3 31 A4 D7 AB 52 EF 3A A9 73 E0 39 AD D3 32
+ Nonce:
+ 7E 58 95 EA F2 67 24 35 BA D8 17 F5 45 A3 71 48
+ Plaintext: (length less than block size)
+ 49 6E 63 6F 6E 63 65 69 76 61 62 6C 65
+ AES Output:
+ 1C 17 3E AD FC 67 C8 BC B3 A5 93 02 98 CB FC 60
+ HMAC Output (truncated):
+ 35 E8 32 B2 EB F4 6A 46 C2 E6 50 D2 50 AB 84 43
+ Ciphertext: (Nonce*  AES Output**  Truncated HMAC Output)
+ 7E 58 95 EA F2 67 24 35 BA D8 17 F5 45 CB FC 60
+ 1C 17 3E AD FC 67 C8 BC B3 A5 93 02 98 35 E8 32
+ B2 EB F4 6A 46 C2 E6 50 D2 50 AB 84 43
+
+ * Only the first 13 bytes of Nonce are sent.
+ ** The AES Output is split and rearranged as described in Section 5
+ since the plaintext length is less than the block size.
+
+ 128bit AES key:
+ 2B 7E 15 16 28 AE D2 A6 AB F7 15 88 09 CF 4F 3C
+ 128bit HMAC key:
+ 67 C3 31 A4 D7 AB 52 EF 3A A9 73 E0 39 AD D3 32
+ Nonce:
+ 7E 58 95 EA F2 67 24 35 BA D8 17 F5 45 A3 71 48
+ Plaintext: (length equals block size)
+ 67 61 73 74 72 6F 69 6E 74 65 73 74 69 6E 61 6C
+ AES Output:
+ F6 71 0B 75 0C 60 65 E8 2E BF F8 9D DC E0 C9 B9
+ HMAC Output (truncated):
+ 7B 2C D9 70 E6 DF 18 F5 E0 3D 8B 8E 40 02 F4 C0
+ Ciphertext: (Nonce  AES Output  Truncated HMAC Output)
+ 7E 58 95 EA F2 67 24 35 BA D8 17 F5 45 A3 71 48
+ F6 71 0B 75 0C 60 65 E8 2E BF F8 9D DC E0 C9 B9
+ 7B 2C D9 70 E6 DF 18 F5 E0 3D 8B 8E 40 02 F4 C0
+
+ 256bit AES key:
+ 60 3D EB 10 15 CA 71 BE 2B 73 AE F0 85 7D 77 81
+ 1F 35 2C 07 3B 61 08 D7 2D 98 10 A3 09 14 DF F4
+ 192bit HMAC key:
+ 37 16 14 EB 62 24 E1 F0 C4 72 6E E6 BE A7 A3 D2
+ F4 62 C6 AC 66 42 A6 AC
+ Nonce:
+ 7E 58 95 EA F2 67 24 35 BA D8 17 F5 45 A3 71 48
+ Plaintext: (length less than block size)
+ 49 6E 63 6F 6E 63 65 69 76 61 62 6C 65
+ AES Output:
+ BD AE EC 5C F9 C9 B6 3C 9D DB A2 B7 9D 5C 6C 0B
+ HMAC Output (truncated):
+ 65 D4 C7 07 8E 14 65 8B C9 B3 C4 EA F5 F7 C2 6F
+ ED 36 AC 7A CD 59 19 2B
+ Ciphertext: (Nonce*  AES Output*  Truncated HMAC Output)
+ 7E 58 95 EA F2 67 24 35 BA D8 17 F5 45 5C 6C 0B
+ BD AE EC 5C F9 C9 B6 3C 9D DB A2 B7 9D 65 D4 C7
+ 07 8E 14 65 8B C9 B3 C4 EA F5 F7 C2 6F ED 36 AC
+ 7A CD 59 19 2B
+
+ * Only the first 13 bytes of Nonce are sent.
+ ** The AES Output is split and rearranged as described in Section 5
+ since the plaintext length is less than the block size.
+
+ 256bit AES key:
+ 60 3D EB 10 15 CA 71 BE 2B 73 AE F0 85 7D 77 81
+ 1F 35 2C 07 3B 61 08 D7 2D 98 10 A3 09 14 DF F4
+ 192bit HMAC key:
+ 37 16 14 EB 62 24 E1 F0 C4 72 6E E6 BE A7 A3 D2
+ F4 62 C6 AC 66 42 A6 AC
+ Nonce:
+ 7E 58 95 EA F2 67 24 35 BA D8 17 F5 45 A3 71 48
+ Plaintext: (length equals block size)
+ 67 61 73 74 72 6F 69 6E 74 65 73 74 69 6E 61 6C
+ AES Output:
+ 5D E5 49 BE D6 50 23 18 78 8F 14 D2 E1 17 E0 5A
+ HMAC Output (truncated):
+ 2C EA DF D5 B0 60 38 DE A9 22 29 2D 7C 56 50 10
+ C5 D6 D2 8D F6 21 E9 7A
+ Ciphertext: (Nonce  AES Output  Truncated HMAC Output)
+ 7E 58 95 EA F2 67 24 35 BA D8 17 F5 45 A3 71 48
+ 5D E5 49 BE D6 50 23 18 78 8F 14 D2 E1 17 E0 5A
+ 2C EA DF D5 B0 60 38 DE A9 22 29 2D 7C 56 50 10
+ C5 D6 D2 8D F6 21 E9 7A
+
+ 128bit AES key:
9B 19 7D D1 E8 C5 60 9D 6E 67 C3 E3 7C 62 C7 2E
 128bit HMAC key (Ki, key usage 2):
+
+ 128bit HMAC key:
9F DA 0E 56 AB 2D 85 E1 56 9A 68 86 96 C2 6A 6C
 Plaintext:
+ Nonce:
+ 8D 32 50 F6 36 AB 81 02 BE 6F AB 1E 57 D8 F8 17
+ Plaintext: (length greater than the block size)
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
10 11 12 13 14
 IV  Ciphertext  Authentication Tag:
+ AES Output:
+ 13 64 FB 39 DC C0 E3 D9 83 A7 DB 5B 4B 9F FB CA
+ 42 F6 65 88 29
+ HMAC Output (truncated):
+ F2 1F C8 95 75 AE 93 C7 57 18 AB 3C 7C FB 28 E1
+ Ciphertext: (Nonce  AES Output  HMAC Output)
8D 32 50 F6 36 AB 81 02 BE 6F AB 1E 57 D8 F8 17
13 64 FB 39 DC C0 E3 D9 83 A7 DB 5B 4B 9F FB CA
42 F6 65 88 29 F2 1F C8 95 75 AE 93 C7 57 18 AB
3C 7C FB 28 E1
 256bit master key:
 6D 40 4D 37 FA F7 9F 9D F0 D3 35 68 D3 20 66 98
 00 EB 48 36 47 2E A8 A0 26 D1 6B 71 82 46 0C 52
 256bit AES key (Ke, key usage 2):
+ 256bit AES key:
56 AB 22 BE E6 3D 82 D7 BC 52 27 F6 77 3F 8E A7
A5 EB 1C 82 51 60 C3 83 12 98 0C 44 2E 5C 7E 49
 192bit HMAC key (Ki, key usage 2):
+ 192bit HMAC key:
69 B1 65 14 E3 CD 8E 56 B8 20 10 D5 C7 30 12 B6
22 C4 D0 0F FC 23 ED 1F
 Plaintext:
+ Nonce:
+ 8D 32 50 F6 36 AB 81 02 BE 6F AB 1E 57 D8 F8 17
+ Plaintext: (length greater than the block size)
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
10 11 12 13 14
 IV  Ciphertext  Authentication Tag:
+ AES Output:
+ 50 CB FF DC DF 38 69 D7 0B EA FF C3 2C 47 0B C6
+ 5B 72 C3 37 2D
+ HMAC Output (truncated):
+ 6E D7 B3 47 E9 0B BD 8F 31 F5 79 58 F9 69 50 BA
+ A1 41 64 6E 65 6C F6 7C
+ Ciphertext: (Nonce  AES Output  HMAC Output)
8D 32 50 F6 36 AB 81 02 BE 6F AB 1E 57 D8 F8 17
50 CB FF DC DF 38 69 D7 0B EA FF C3 2C 47 0B C6
5B 72 C3 37 2D 6E D7 B3 47 E9 0B BD 8F 31 F5 79
58 F9 69 50 BA A1 41 64 6E 65 6C F6 7C
Sample checksums:
+ 
Checksum type: hmacsha256128aes128
128bit master key:
37 05 D9 60 80 C1 77 28 A0 E8 00 EA B6 E0 D2 3C
128bit HMAC key (Kc, key usage 2):
+
B3 1A 01 8A 48 F5 47 76 F4 03 E9 A3 96 32 5D C3
Plaintext:
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
10 11 12 13 14
Checksum:
D7 83 67 18 66 43 D6 7B 41 1C BA 91 39 FC 1D EE
Checksum type: hmacsha384192aes256
256bit master key:
6D 40 4D 37 FA F7 9F 9D F0 D3 35 68 D3 20 66 98