Tech-invite3GPPspaceIETFspace
959493929190898887868584838281807978777675747372717069686766656463626160595857565554535251504948474645444342414039383736353433323130292827262524232221201918171615141312111009080706050403020100
in Index   Prev   Next

RFC 8645

Re-keying Mechanisms for Symmetric Keys

Pages: 69
Informational
Part 1 of 3 – Pages 1 to 20
None   None   Next

Top   ToC   RFC8645 - Page 1
Internet Research Task Force (IRTF)                   S. Smyshlyaev, Ed.
Request for Comments: 8645                                     CryptoPro
Category: Informational                                      August 2019
ISSN: 2070-1721


                Re-keying Mechanisms for Symmetric Keys

Abstract

A certain maximum amount of data can be safely encrypted when encryption is performed under a single key. This amount is called the "key lifetime". This specification describes a variety of methods for increasing the lifetime of symmetric keys. It provides two types of re-keying mechanisms based on hash functions and block ciphers that can be used with modes of operations such as CTR, GCM, CBC, CFB, and OMAC. This document is a product of the Crypto Forum Research Group (CFRG) in the IRTF. 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 Research Task Force (IRTF). The IRTF publishes the results of Internet-related research and development activities. These results might not be suitable for deployment. This RFC represents the consensus of the Crypto Forum Research Group of the Internet Research Task Force (IRTF). Documents approved for publication by the IRSG are not candidates 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 https://www.rfc-editor.org/info/rfc8645.
Top   ToC   RFC8645 - Page 2
Copyright Notice

   Copyright (c) 2019 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
   (https://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.
Top   ToC   RFC8645 - Page 3

Table of Contents

1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 4 2. Conventions Used in This Document . . . . . . . . . . . . . . 7 3. Basic Terms and Definitions . . . . . . . . . . . . . . . . . 7 4. Choosing Constructions and Security Parameters . . . . . . . 9 5. External Re-keying Mechanisms . . . . . . . . . . . . . . . . 11 5.1. Methods of Key Lifetime Control . . . . . . . . . . . . . 14 5.2. Parallel Constructions . . . . . . . . . . . . . . . . . 14 5.2.1. Parallel Construction Based on a KDF on a Block Cipher . . . . . . . . . . . . . . . . . . . . . . . 15 5.2.2. Parallel Construction Based on a KDF on a Hash Function . . . . . . . . . . . . . . . . . . . . . . 16 5.2.3. Tree-Based Construction . . . . . . . . . . . . . . . 16 5.3. Serial Constructions . . . . . . . . . . . . . . . . . . 17 5.3.1. Serial Construction Based on a KDF on a Block Cipher 19 5.3.2. Serial Construction Based on a KDF on a Hash Function 19 5.4. Using Additional Entropy during Re-keying . . . . . . . . 19 6. Internal Re-keying Mechanisms . . . . . . . . . . . . . . . . 20 6.1. Methods of Key Lifetime Control . . . . . . . . . . . . . 22 6.2. Constructions that Do Not Require a Master Key . . . . . 23 6.2.1. ACPKM Re-keying Mechanisms . . . . . . . . . . . . . 23 6.2.2. CTR-ACPKM Encryption Mode . . . . . . . . . . . . . . 25 6.2.3. GCM-ACPKM Authenticated Encryption Mode . . . . . . . 26 6.3. Constructions that Require a Master Key . . . . . . . . . 29 6.3.1. ACPKM-Master Key Derivation from the Master Key . . . 29 6.3.2. CTR-ACPKM-Master Encryption Mode . . . . . . . . . . 31 6.3.3. GCM-ACPKM-Master Authenticated Encryption Mode . . . 33 6.3.4. CBC-ACPKM-Master Encryption Mode . . . . . . . . . . 37 6.3.5. CFB-ACPKM-Master Encryption Mode . . . . . . . . . . 39 6.3.6. OMAC-ACPKM-Master Authentication Mode . . . . . . . . 40 7. Joint Usage of External and Internal Re-keying . . . . . . . 42 8. Security Considerations . . . . . . . . . . . . . . . . . . . 43 9. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 43 10. References . . . . . . . . . . . . . . . . . . . . . . . . . 44 10.1. Normative References . . . . . . . . . . . . . . . . . . 44 10.2. Informative References . . . . . . . . . . . . . . . . . 45 Appendix A. Test Examples . . . . . . . . . . . . . . . . . . . 48 A.1. Test Examples for External Re-keying . . . . . . . . . . 48 A.1.1. External Re-keying with a Parallel Construction . . . 48 A.1.2. External Re-keying with a Serial Construction . . . . 49 A.2. Test Examples for Internal Re-keying . . . . . . . . . . 52 A.2.1. Internal Re-keying Mechanisms that Do Not Require a Master Key . . . . . . . . . . . . . . . . 52 A.2.2. Internal Re-keying Mechanisms with a Master Key . . . 56 Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . 69 Contributors . . . . . . . . . . . . . . . . . . . . . . . . . . 69 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 69
Top   ToC   RFC8645 - Page 4

1. Introduction

A certain maximum amount of data can be safely encrypted when encryption is performed under a single key. Hereinafter, this amount will be referred to as the "key lifetime". The need for such a limitation is dictated by the following methods of cryptanalysis: 1. Methods based on the combinatorial properties of the used block cipher mode of operation These methods do not depend on the underlying block cipher. Common mode restrictions derived from such methods are of order 2^{n/2}, where n is a block size defined in Section 3. [Sweet32] includes an example of an attack that is based on such methods. 2. Methods based on side-channel analysis issues In most cases, these methods do not depend on the used encryption modes and weakly depend on the used cipher features. Limitations resulting from these considerations are usually the most restrictive ones. [TEMPEST] is an example of an attack that is based on such methods. 3. Methods based on the properties of the used block cipher The most common methods of this type are linear and differential cryptanalysis [LDC]. In most cases, these methods do not depend on the used modes of operation. In the case of secure block ciphers, bounds resulting from such methods are roughly the same as the natural bounds of 2^n and are dominated by the other bounds above. Therefore, they can be excluded from the considerations here. As a result, it is important to replace a key when the total size of the processed plaintext under that key approaches the lifetime limitation. A specific value of the key lifetime should be determined in accordance with some safety margin for protocol security and the methods outlined above. Suppose L is a key lifetime limitation in some protocol P. For simplicity, assume that all messages have the same length m. Hence, the number of messages q that can be processed with a single key K should be such that m * q <= L. This can be depicted graphically as a rectangle with sides m and q enclosed by area L (see Figure 1).
Top   ToC   RFC8645 - Page 5
                      +------------------------+
                      |                      L |
                      | +--------m---------+   |
                      | |==================|   |
                      | |==================|   |
                      | q==================|   |       m * q <= L
                      | |==================|   |
                      | |==================|   |
                      | +------------------+   |
                      +------------------------+

         Figure 1: Graphic Display of the Key Lifetime Limitation

   In practice, the amount of data that corresponds to limitation L may
   not be enough.  The simplest and obvious solution in this situation
   is a regular renegotiation of an initial key after processing this
   threshold amount of data L.  However, this reduces the total
   performance, since it usually entails termination of application data
   transmission, additional service messages, the use of a random number
   generator, and many other additional calculations, including
   resource-intensive public key cryptography.

   For protocols based on block ciphers or stream ciphers, a more
   efficient way to increase the key lifetime is to use various
   re-keying mechanisms.  This specification considers re-keying
   mechanisms for block ciphers only; re-keying mechanisms typical for
   stream ciphers (e.g., [Pietrzak2009], [FPS2012]) are beyond the scope
   of this document.

   Re-keying mechanisms can be applied at the different protocol levels:
   the block cipher level (this approach is known as fresh re-keying and
   is described, for instance, in [FRESHREKEYING]; the block cipher mode
   of operation level (see Section 6); and the protocol level above the
   block cipher mode of operation (see Section 5).  The usage of the
   first approach is highly inefficient due to the key changing after
   each message block is processed.  Moreover, fresh re-keying
   mechanisms can change the block cipher internal structure and,
   consequently, can require an additional security analysis for each
   particular block cipher.  As a result, this approach depends on
   particular primitive properties and cannot be applied to any
   arbitrary block cipher without additional security analysis.
   Therefore, fresh re-keying mechanisms go beyond the scope of this
   document.

   Thus, this document contains the list of recommended re-keying
   mechanisms that can be used in the symmetric encryption schemes based
   on the block ciphers.  These mechanisms are independent from the
Top   ToC   RFC8645 - Page 6
   particular block cipher specification, and their security properties
   rely only on the standard block cipher security assumption.

   This specification presents two basic approaches to extending the
   lifetime of a key while avoiding renegotiation, which were introduced
   in [AAOS2017]:

   1.  External re-keying

      External re-keying is performed by a protocol, and it is
      independent of the underlying block cipher and the mode of
      operation.  External re-keying can use parallel and serial
      constructions.  In the parallel case, data processing keys K^1,
      K^2, ... are generated directly from the initial key K
      independently of each other.  In the serial case, every data-
      processing key depends on the state that is updated after the
      generation of each new data-processing key.

      As a generalization of external parallel re-keying, an external
      tree-based mechanism can be considered.  It is specified in
      Section 5.2.3 and can be viewed as the tree generalization in
      [GGM].  Similar constructions are used in the one-way tree
      mechanism ([OWT]) and [AESDUKPT] standard.

   2.  Internal re-keying

      Internal re-keying is built into the mode, and it depends heavily
      on the properties of the mode of operation and the block size.

   The re-keying approaches extend the key lifetime for a single initial
   key by allowing the leakages to be limited (via side channels) and by
   improving the combinatorial properties of the used block cipher mode
   of operation.

   In practical applications, re-keying can be useful for protocols that
   need to operate in hostile environments or under restricted resource
   conditions (e.g., those that require lightweight cryptography, where
   ciphers have a small block size that imposes strict combinatorial
   limitations).  Moreover, mechanisms that use external or internal
   re-keying may provide some protection against possible future attacks
   (by limiting the number of plaintext-ciphertext pairs that an
   adversary can collect) and some properties of forward or backward
   security (meaning that past or future data-processing keys remain
   secure even if the current key is compromised; see [AbBell] for more
   details).  External or internal re-keying can be used in network
   protocols as well as in the systems for data-at-rest encryption.
Top   ToC   RFC8645 - Page 7
   Depending on the concrete protocol characteristics, there might be
   situations in which both external and internal re-keying mechanisms
   (see Section 7) can be applied.  For example, a similar approach was
   used in Taha's tree construction (see [TAHA]).

   Note that there are key-updating (key regression) algorithms (e.g.,
   [FKK2005] and [KMNT2003]) that are called "re-keying" as well, but
   they pursue goals other than increasing the key lifetime.  Therefore,
   key regression algorithms are excluded from the considerations here.

   This document represents the consensus of the Crypto Forum Research
   Group (CFRG).

2. Conventions Used in This Document

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here.

3. Basic Terms and Definitions

This document uses the following terms and definitions for the sets and operations on the elements of these sets: V* the set of all bit strings of a finite length (hereinafter referred to as strings), including the empty string; V_s the set of all bit strings of length s, where s is a non-negative integer; |X| the bit length of the bit string X; A | B the concatenation of strings A and B both belonging to V*, i.e., a string in V_{|A|+|B|}, where the left substring in V_|A| is equal to A and the right substring in V_|B| is equal to B; (xor) the exclusive-or of two bit strings of the same length; Z_{2^n} the ring of residues modulo 2^n; Int_s: V_s -> Z_{2^s} the transformation that maps the string a = (a_s, ... , a_1) in V_s into the integer Int_s(a) = 2^{s-1} * a_s + ... + 2 * a_2 + a_1 (the interpretation of the binary string as an integer);
Top   ToC   RFC8645 - Page 8
   Vec_s: Z_{2^s} -> V_s
           the transformation inverse to the mapping Int_s (the
           interpretation of an integer as a binary string);

   MSB_i: V_s -> V_i
           the transformation that maps the string a = (a_s, ... , a_1)
           in V_s into the string MSB_i(a) = (a_s, ... , a_{s-i+1}) in
           V_i (most significant bits);

   LSB_i: V_s -> V_i
           the transformation that maps the string a = (a_s, ... , a_1)
           in V_s into the string LSB_i(a) = (a_i, ... , a_1) in V_i
           (least significant bits);

   Inc_c: V_s -> V_s
           the transformation that maps the string a = (a_s, ... , a_1)
           in V_s into the string Inc_c(a) = MSB_{|a|-c}(a) |
           Vec_c(Int_c(LSB_c(a)) + 1(mod 2^c)) in V_s (incrementing the
           least significant c bits of the bit string, regarded as the
           binary representation of an integer);

   a^s     the string in V_s that consists of s 'a' bits;

   E_{K}: V_n -> V_n
           the block cipher permutation under the key K in V_k;

   ceil(x) the smallest integer that is greater than or equal to x;

   floor(x)
           the biggest integer that is less than or equal to x;

   k       the bit length of the K; k is assumed to be divisible by 8;

   n       the block size of the block cipher (in bits); n is assumed to
           be divisible by 8;

   b       the number of data blocks in the plaintext P (b =
           ceil(|P|/n));

   N       the section size (the number of bits that are processed with
           one section key before this key is transformed).

   A plaintext message P and the corresponding ciphertext C are divided
   into b = ceil(|P|/n) blocks, denoted as P = P_1 | P_2 | ... | P_b and
   C = C_1 | C_2 | ... | C_b, respectively.  The first b-1 blocks P_i
   and C_i are in V_n for i = 1, 2, ... , b-1.  The b-th blocks P_b and
   C_b may be incomplete blocks, i.e., in V_r, where r <= n if not
   otherwise specified.
Top   ToC   RFC8645 - Page 9

4. Choosing Constructions and Security Parameters

External re-keying is an approach assuming that a key is transformed after encrypting a limited number of entire messages. The external re-keying method is chosen at the protocol level, regardless of the underlying block cipher or the encryption mode. External re-keying is recommended for protocols that process relatively short messages or protocols that have a way to divide a long message into manageable pieces. Through external re-keying, the number of messages that can be securely processed with a single initial key K is substantially increased without a loss of message length. External re-keying has the following advantages 1. It increases the lifetime of an initial key by increasing the number of messages processed with this key. 2. It has minimal impact on performance when the number of messages processed under one initial key is sufficiently large. 3. It provides forward and backward security of data-processing keys. However, the use of external re-keying has the following disadvantage: in cases with restrictive key lifetime limitations, the message sizes can become obstructive due to the impossibility of processing sufficiently large messages, so it may be necessary to perform additional fragmentation at the protocol level. For example, if the key lifetime L is 1 GB and the message length m = 3 GB, then this message cannot be processed as a whole, and it should be divided into three fragments that will be processed separately. Internal re-keying is an approach assuming that a key is transformed during each separate message processing. Such procedures are integrated into the base modes of operations, so every internal re-keying mechanism is defined for the particular operation mode and the block size of the used cipher. Internal re-keying is recommended for protocols that process long messages: the size of each single message can be substantially increased without loss in the number of messages that can be securely processed with a single initial key. Internal re-keying has the following advantages: 1. It increases the lifetime of an initial key by increasing the size of the messages processed with one initial key. 2. It has minimal impact on performance.
Top   ToC   RFC8645 - Page 10
   3.  Internal re-keying mechanisms without a master key do not affect
       short-message transformation at all.

   4.  It is transparent (works like any mode of operation): it does not
       require changes of initialization vectors (IVs) and a restart of
       MACing.

   However, the use of internal re-keying has the following
   disadvantages:

   1.  a specific method must not be chosen independently of a mode of
       operation.

   2.  internal re-keying mechanisms without a master key do not provide
       backward security of data-processing keys.

   Any block cipher modes of operations with internal re-keying can be
   jointly used with any external re-keying mechanisms.  Such joint
   usage increases both the number of messages processed with one
   initial key and their maximum possible size.

   If the adversary has access to the data-processing interface, the use
   of the same cryptographic primitives both for data-processing and
   re-keying transformation decreases the code size but can lead to some
   possible vulnerabilities (the possibility of mounting a chosen-
   plaintext attack may lead to the compromise of the following keys).
   This vulnerability can be eliminated by using different primitives
   for data processing and re-keying, e.g., block cipher for data
   processing and hash for re-keying (see Section 5.2.2 and
   Section 5.3.2).  However, in this case, the security of the whole
   scheme cannot be reduced to standard notions like a pseudorandom
   function (PRF) or pseudorandom permutation (PRP), so security
   estimations become more difficult and unclear.

   Summing up the abovementioned issues briefly:

   1.  If a protocol assumes processing of long records (e.g., [CMS]),
       internal re-keying should be used.  If a protocol assumes
       processing of a significant number of ordered records, which can
       be considered as a single data stream (e.g., [TLS], [SSH]),
       internal re-keying may also be used.

   2.  For protocols that allow out-of-order delivery and lost records
       (e.g., [DTLS], [ESP]), external re-keying should be used as, in
       this case, records cannot be considered as a single data stream.
       If the records are also long enough, internal re-keying should
       also be used during each separate message processing.
Top   ToC   RFC8645 - Page 11
   For external re-keying:

   1.  If it is desirable to separate transformations used for data
       processing and key updates, hash function-based re-keying should
       be used.

   2.  If parallel data processing is required, then parallel external
       re-keying should be used.

   3.  If restrictive key lifetime limitations are present, external
       tree-based re-keying should be used.

   For internal re-keying:

   1.  If the property of forward and backward security is desirable for
       data-processing keys and if additional key material can be easily
       obtained for the data-processing stage, internal re-keying with a
       master key should be used.

5. External Re-keying Mechanisms

This section presents an approach to increasing the initial key lifetime by using a transformation of a data-processing key (frame key) after processing a limited number of entire messages (frame). The approach provides external parallel and serial re-keying mechanisms (see [AbBell]). These mechanisms use initial key K only for frame key generation and never use it directly for data processing. Such mechanisms operate outside of the base modes of operations and do not change them at all; therefore, they are called "external re-keying" mechanisms in this document. External re-keying mechanisms are recommended for usage in protocols that process quite small messages, since the maximum gain in increasing the initial key lifetime is achieved by increasing the number of messages. External re-keying increases the initial key lifetime through the following approach. Suppose there is a protocol P with some mode of operation (base encryption or authentication mode). Let L1 be a key lifetime limitation induced by side-channel analysis methods (side- channel limitation), let L2 be a key lifetime limitation induced by methods based on the combinatorial properties of a used mode of operation (combinatorial limitation), and let q1, q2 be the total numbers of messages of length m that can be safely processed with an initial key K according to these limitations.
Top   ToC   RFC8645 - Page 12
   Let L = min(L1, L2), q = min(q1, q2), and q * m <= L.  As the L1
   limitation is usually much stronger than the L2 limitation (L1 < L2),
   the final key lifetime restriction is equal to the most restrictive
   limitation L1.  Thus, as displayed in Figure 2, without re-keying,
   only q1 (q1 * m <= L1) messages can be safely processed.

                         <--------m------->
                         +----------------+ ^ ^
                         |================| | |
                         |================| | |
                     K-->|================| q1|
                         |================| | |
                         |==============L1| | |
                         +----------------+ v |
                         |                |   |
                         |                |   |
                         |                |   q2
                         |                |   |
                         |                |   |
                         |                |   |
                         |                |   |
                         |                |   |
                         |                |   |
                         |                |   |
                         |                |   |
                         |              L2|   |
                         +----------------+   v

             Figure 2: Basic Principles of Message Processing
                        without External Re-keying

   Suppose that the safety margin for the protocol P is fixed and the
   external re-keying approach is applied to the initial key K to
   generate the sequence of frame keys.  The frame keys are generated in
   such a way that the leakage of a previous frame key does not have any
   impact on the following one, so the side-channel limitation L1 is
   switched off.  Thus, the resulting key lifetime limitation of the
   initial key K can be calculated on the basis of a new combinatorial
   limitation L2'.  It is proven (see [AbBell]) that the security of the
   mode of operation that uses external re-keying leads to an increase
   when compared to base mode without re-keying (thus, L2 < L2').
   Hence, as displayed in Figure 3, the resulting key lifetime
   limitation if using external re-keying can be increased up to L2'.
Top   ToC   RFC8645 - Page 13
                         <--------m------->
                   K     +----------------+
                   |     |================|
                   v     |================|
                  K^1--> |================|
                   |     |================|
                   |     |==============L1|
                   |     +----------------+
                   |     |================|
                   v     |================|
                  K^2--> |================|
                   |     |================|
                   |     |==============L1|
                   |     +----------------+
                   |     |================|
                   v     |================|
                  ...    |      . . .     |
                         |                |
                         |                |
                         |              L2|
                         +----------------+
                         |                |
                        ...              ...
                         |             L2'|
                         +----------------+

             Figure 3: Basic Principles of Message Processing
                          with External Re-keying

   Note: The key transformation process is depicted in a simplified
   form.  A specific approach (parallel and serial) is described below.

   Consider an example.  Let the message size in a protocol P be equal
   to 1 KB.  Suppose L1 = 128 MB and L2 = 1 TB.  Thus, if an external
   re-keying mechanism is not used, the initial key K must be
   renegotiated after processing 128 MB / 1 KB = 131072 messages.

   If an external re-keying mechanism is used, the key lifetime
   limitation L1 goes off.  Hence, the resulting key lifetime limitation
   L2' can be set to more than 1 TB.  Thus, if an external re-keying
   mechanism is used, more than 1 TB / 1 KB = 2^30 messages can be
   processed before the initial key K is renegotiated.  This is 8192
   times greater than the number of messages that can be processed when
   an external re-keying mechanism is not used.
Top   ToC   RFC8645 - Page 14

5.1. Methods of Key Lifetime Control

Suppose L is an amount of data that can be safely processed with one frame key. For i in {1, 2, ... , t}, the frame key K^i (see Figures 4 and 6) should be transformed after processing q_i messages, where q_i can be calculated in accordance with one of the following approaches: Explicit approach: q_i is such that |M^{i,1}| + ... + |M^{i,q_i}| <= L, |M^{i,1}| + ... + |M^{i,q_i+1}| > L. This approach allows use of the frame key K^i in an almost optimal way, but it can be applied only when messages cannot be lost or reordered (e.g., TLS records). Implicit approach: q_i = L / m_max, i = 1, ... , t. The amount of data processed with one frame key K^i is calculated under the assumption that every message has the maximum length m_max. Hence, this amount can be considerably less than the key lifetime limitation L. On the other hand, this approach can be applied when messages may be lost or reordered (e.g., DTLS records). Dynamic key changes: We can organize the key change using the Protected Point to Point ([P3]) solution by building a protected tunnel between the endpoints in which the information about frame key updating can be safely passed across. This can be useful, for example, when we want the adversary to not detect the key change during the protocol evaluation.

5.2. Parallel Constructions

External parallel re-keying mechanisms generate frame keys K^1, K^2, ... directly from the initial key K independently of each other. The main idea behind external re-keying with a parallel construction is presented in Figure 4:
Top   ToC   RFC8645 - Page 15
   Maximum message size = m_max.
   _____________________________________________________________

                                   m_max
                             <---------------->
                   M^{1,1}   |===             |
                   M^{1,2}   |=============== |
         +->K^1-->   ...            ...
         |         M^{1,q_1} |========        |
         |
         |
         |         M^{2,1}   |================|
         |         M^{2,2}   |=====           |
   K-----|->K^2-->   ...            ...
         |         M^{2,q_2} |==========      |
         |
        ...
         |         M^{t,1}   |============    |
         |         M^{t,2}   |=============   |
         +->K^t-->   ...            ...
                   M^{t,q_t} |==========      |

   _____________________________________________________________

             Figure 4: External Parallel Re-keying Mechanisms

   The frame key K^i, i = 1, ... , t - 1 is updated after processing a
   certain number of messages (see Section 5.1).

5.2.1. Parallel Construction Based on a KDF on a Block Cipher

The ExtParallelC re-keying mechanism is based on the key derivation function on a block cipher and is used to generate t frame keys as follows: K^1 | K^2 | ... | K^t = ExtParallelC(K, t * k) = MSB_{t * k}(E_{K}(Vec_n(0)) | E_{K}(Vec_n(1)) | ... | E_{K}(Vec_n(R - 1))), where R = ceil(t * k/n).
Top   ToC   RFC8645 - Page 16

5.2.2. Parallel Construction Based on a KDF on a Hash Function

The ExtParallelH re-keying mechanism is based on the key derivation function HKDF-Expand, described in [RFC5869], and is used to generate t frame keys as follows: K^1 | K^2 | ... | K^t = ExtParallelH(K, t * k) = HKDF-Expand(K, label, t * k), where label is a string (may be a zero-length string) that is defined by a specific protocol.

5.2.3. Tree-Based Construction

The application of an external tree-based mechanism leads to the construction of the key tree with the initial key K (root key) at the 0 level and the frame keys K^1, K^2, ... at the last level, as described in Figure 5. K_root = K ___________|___________ | ... | V V K{1,1} K{1,W1} ______|______ ______|______ | ... | | ... | V V V V K{2,1} K{2,W2} K{2,(W1-1)*W2+1} K{2,W1*W2} __|__ __|__ __|__ __|__ | ... | | ... | | ... | | ... | V V V V V V V V K{3,1} ... ... ... ... ... ... K{3,W1*W2*W3} ... ... __|__ ... __|__ | ... | | ... | V V V V K{h,1} K{h,Wh} K{h,(W1*...*W{h-1}-1)*Wh+1} K{h,W1*...*Wh} // \\ // \\ K^1 K^{Wh} K^{(W1*...*W{h-1}-1)*Wh+1} K^{W1*...*Wh} ____________________________________________________________________ Figure 5: External Tree-Based Mechanism The tree height h and the number of keys Wj, j in {1, ... , h}, which can be partitioned from the "parent" key, are defined in accordance with a specific protocol and key lifetime limitations for the used derivation functions.
Top   ToC   RFC8645 - Page 17
   Each j-level key K{j,w}, where j in {1, ... , h}, w in {1, ... , W1 *
   ... * Wj}, is derived from the (j-1)-level "parent" key K{j-1,
   ceil(w/Wi)} (and other appropriate input data) using the j-th level
   derivation function.  This function can be based on the block cipher
   function or on the hash function and is defined in accordance with a
   specific protocol.

   The i-th frame K^i, i in {1, 2, ... , W1*...*Wh}, can be calculated
   as follows:

      K^i = ExtKeyTree(K, i) = KDF_h(KDF_{h-1}(... KDF_1(K, ceil(i / (W2
      * ... * Wh)) ... , ceil(i / Wh)), i),

   where KDF_j is the j-th level derivation function that takes two
   arguments (the parent key value and the integer in a range from 1 to
   W1 * ... * Wj) and outputs the j-th level key value.

   The frame key K^i is updated after processing a certain number of
   messages (see Section 5.1).

   In order to create an efficient implementation, during frame key K^i
   generation, the derivation functions KDF_j, j in {1, ... , h-1}
   should be used only when ceil(i / (W{j+1} * ... * Wh)) != ceil((i -
   1) / (W{j+1} * ... * Wh)); otherwise, it is necessary to use a
   previously generated value.  This approach also makes it possible to
   take countermeasures against side-channel attacks.

   Consider an example.  Suppose h = 3, W1 = W2 = W3 = W, and KDF_1,
   KDF_2, KDF_3 are key derivation functions based on the
   KDF_GOSTR3411_2012_256 (hereafter simply KDF) function described in
   [RFC7836].  The resulting ExtKeyTree function can be defined as
   follows:

      ExtKeyTree(K, i) = KDF(KDF(KDF(K, "level1", ceil(i / W^2)),
      "level2", ceil(i / W)), "level3", i).

   where i in {1, 2, ... , W^3}.

   A structure similar to the external tree-based mechanism can be found
   in Section 6 of [NISTSP800-108].

5.3. Serial Constructions

External serial re-keying mechanisms generate frame keys, each of which depends on the secret state (K*_1, K*_2, ...) that is updated after the generation of each new frame key; see Figure 6. Similar approaches are used in the [SIGNAL] protocol and the [TLS] updating
Top   ToC   RFC8645 - Page 18
   traffic key mechanism and were proposed for use in the [U2F]
   protocol.

   External serial re-keying mechanisms have the obvious disadvantage of
   being impossible to implement in parallel, but they may be the
   preferred option if additional forward secrecy is desirable.  If all
   keys are securely deleted after usage, the compromise of a current
   secret state at some point does not lead to a compromise of all
   previous secret states and frame keys.  In terms of [TLS], compromise
   of application_traffic_secret_N does not compromise all previous
   application_traffic_secret_i, i < N.

   The main idea behind external re-keying with a serial construction is
   presented in Figure 6:

   Maximum message size = m_max.
   _____________________________________________________________
                                        m_max
                                  <---------------->
                        M^{1,1}   |===             |
                        M^{1,2}   |=============== |
   K*_1 = K --->K^1-->    ...            ...
     |                  M^{1,q_1} |========        |
     |
     |
     |                  M^{2,1}   |================|
     v                  M^{2,2}   |=====           |
   K*_2 ------->K^2-->    ...            ...
     |                  M^{2,q_2} |==========      |
     |
    ...
     |                  M^{t,1}   |============    |
     v                  M^{t,2}   |=============   |
   K*_t ------->K^t-->    ...            ...
                        M^{t,q_t} |==========      |


   _____________________________________________________________

              Figure 6: External Serial Re-keying Mechanisms

   The frame key K^i, i = 1, ... , t - 1, is updated after processing a
   certain number of messages (see Section 5.1).
Top   ToC   RFC8645 - Page 19

5.3.1. Serial Construction Based on a KDF on a Block Cipher

The frame key K^i is calculated using the ExtSerialC transformation as follows: K^i = ExtSerialC(K, i) = MSB_k(E_{K*_i}(Vec_n(0)) |E_{K*_i}(Vec_n(1)) | ... | E_{K*_i}(Vec_n(J - 1))), where J = ceil(k / n), i = 1, ... , t, K*_i is calculated as follows: K*_1 = K, K*_{j+1} = MSB_k(E_{K*_j}(Vec_n(J)) | E_{K*_j}(Vec_n(J + 1)) | ... | E_{K*_j}(Vec_n(2 * J - 1))), where j = 1, ... , t - 1.

5.3.2. Serial Construction Based on a KDF on a Hash Function

The frame key K^i is calculated using the ExtSerialH transformation as follows: K^i = ExtSerialH(K, i) = HKDF-Expand(K*_i, label1, k), where i = 1, ... , t; HKDF-Expand is the HMAC-based key derivation function, as described in [RFC5869]; and K*_i is calculated as follows: K*_1 = K, K*_{j+1} = HKDF-Expand(K*_j, label2, k), where j = 1, ... , t - 1, where label1 and label2 are different strings from V* that are defined by a specific protocol (see, for example, the algorithm for updating traffic keys in TLS 1.3 [TLS]).

5.4. Using Additional Entropy during Re-keying

In many cases, using additional entropy during re-keying won't increase security but may give a false sense of that. Therefore, one can rely on additional entropy only after conducting a deep security analysis. For example, good PRF constructions do not require additional entropy for the quality of keys, so, in most cases, there is no need to use additional entropy with external re-keying mechanisms based on secure KDFs. However, in some situations, mixed- in entropy can still increase security in the case of a time-limited
Top   ToC   RFC8645 - Page 20
   but complete breach of the system when an adversary can access the
   frame-key generation interface but cannot reveal the master keys
   (e.g., when the master keys are stored in a Hardware Security Module
   (HSM)).

   For example, an external parallel construction based on a KDF on a
   hash function with a mixed-in entropy can be described as follows:

      K^i = HKDF-Expand(K, label_i, k),

   where label_i is additional entropy that must be sent to the
   recipient (e.g., sent jointly with an encrypted message).  The
   entropy label_i and the corresponding key K^i must be generated
   directly before message processing.



(page 20 continued on part 2)

Next Section