Rekeying Mechanisms for Symmetric Keys
CryptoPro
18, Suschevskiy val
Moscow
127018
Russian Federation
+7 (495) 9954820
svs@cryptopro.ru
General
CFRG
rekeying, key, key lifetime, encryption mode, mode of operation
A certain maximum amount of data can be safely encrypted when
encryption is performed under a single key. This amount is called "key lifetime".
This specification describes a variety of methods to increase the lifetime of symmetric keys.
It provides two types of rekeying mechanisms based on hash functions and on 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.
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 "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 modes restrictions derived from such methods are of order 2^{n/2}, where n is a block size defined in .
is an example of attack that is based on such methods.
2. Methods based on sidechannel analysis issues

In most cases these methods do not depend on the used encryption modes and weakly depend on the used
block cipher features. Limitations resulting from these considerations are usually the most restrictive ones.
is an example of 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 .
In most cases these methods do not depend on the used modes of operation.
In 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 which is enclosed by area L (see Figure 1).
In practice, such amount of data that corresponds to limitation L may not be enough.
The simplest and obvious way 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 random number generator and many other additional calculations,
including resourceintensive public key cryptography.
For the protocols based on block ciphers or stream ciphers a more efficient way to increasing the key lifetime is to use various rekeying mechanisms.
This specification considers only the case of rekeying mechanisms for block ciphers, while rekeying mechanisms typical for stream ciphers
(e.g., , ) case go beyond the scope of this document.
Rekeying mechanisms can be applied on the different protocol levels: on the block cipher level (this approach is known as fresh rekeying and is described, for instance, in ),
on the block cipher mode of operation level (see ),
on the protocol level above the block cipher mode of operation (see ).
The usage of the first approach is highly inefficient due to the key changing after processing each message block.
Moreover, fresh rekeying mechanisms can change the block cipher internal structure, and, consequently, can require the additional security analysis for each particular block cipher.
As a result, this approach depends on particular primitive properties and can not be applied to any arbitrary block cipher without additional security analysis, therefore, fresh rekeying mechanisms go beyond the scope of this document.
Thus, this document contains the list of recommended rekeying mechanisms that can be used in the symmetric encryption schemes based on the block ciphers.
These mechanisms are independent from the particular block cipher specification and their security properties rely only on the standard block cipher security assumption.
This specification presents two basic approaches to extend the lifetime of a key while avoiding renegotiation that were introduced in :
1. External rekeying

External rekeying is performed by a protocol, and it is independent of the underlying block cipher and the mode of operation.
External rekeying 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 rekeying an external treebased mechanism can be considered.
It is specified in the and can be viewed as the
tree generalization. Similar constructions are used in the oneway tree mechanism () and standard.
2. Internal rekeying

Internal rekeying is built into the mode, and it depends heavily on the properties of the mode of operation and the block size.
The rekeying approaches extend the key lifetime for a single initial key by providing the possibility
to limit the leakages (via side channels)
and by improving combinatorial properties of the used block cipher mode of operation.
In practical applications, rekeying can be useful for protocols that need to operate in hostile environments
or under restricted resource conditions (e.g., that require lightweight cryptography, where ciphers have a small block size, that imposes strict combinatorial limitations).
Moreover, mechanisms that use external or internal rekeying may provide some protection against possible future attacks (by limiting the number of plaintextciphertext 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 for more details ).
External or internal rekeying can be used in network protocols as well as in the systems for dataatrest encryption.
Depending on the concrete protocol characteristics there might be situations in which both external and internal rekeying mechanisms (see ) can be applied.
For example, the similar approach was used in the Taha's tree construction (see ).
Note that there are key updating (key regression) algorithms (e.g., and ) which are called "rekeying" as well,
but they pursue the goal different from increasing key lifetime. Therefore, key regression algorithms are excluded from the considerations here.
This document represents the consensus of the Crypto Forum Research Group (CFRG).
Conventions Used in This Document
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT",
"RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in
.
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 nonnegative integer;
 X

the bit length of the bit string X;
 A  B

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)

exclusiveor of two bit strings of the same length;
 Z_{2^n}

ring of residues modulo 2^n;
 Int_s: V_s > Z_{2^s}

the transformation that maps a string a = (a_s, ... , a_1) in V_s
into the integer Int_s(a) = 2^{s1} * a_s + ... + 2 * a_2 + a_1
(the interpretation of the binary string as an integer);
 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_{si+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_{ac}(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 bitlength 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 P = P_1  P_2  ...  P_b and C = C_1  C_2  ...  C_b, respectively. The first b1 blocks
P_i and C_i are in V_n, for i = 1, 2, ... , b1. The bth blocks P_b, C_b may be an incomplete blocks, i.e., in V_r, where r <= n if not otherwise specified.
Choosing Constructions and Security Parameters
External rekeying is an approach assuming that a key is transformed after encrypting a limited number of entire messages.
External rekeying method is chosen at the protocol level, regardless of the underlying block cipher or the encryption mode.
External rekeying is recommended for protocols that process relatively short messages or
for protocols that have a way to divide a long message into manageable pieces.
Through external rekeying the number of messages that can be securely processed with a single initial key K is substantially increased without loss in message length.
External rekeying has the following advantages:

it increases the lifetime of an initial key by increasing the number of messages processed with this key;

it has minimal impact on performance, when the number of messages processed under one initial key is sufficiently large;

it provides forward and backward security of data processing keys.
However, the use of external rekeying has the following disadvantage:
in case of restrictive key lifetime limitations the message sizes can become
inconvenient due to impossibility of processing sufficiently large messages, so it could
be necessary to perform additional fragmentation at the protocol level. E.g. 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 rekeying 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 rekeying mechanism
is defined for the particular operation mode and the block size of the used cipher.
Internal rekeying is recommended for protocols that process long messages:
the size of each single message can be substantially increased without loss in number of messages that can be securely processed with a single initial key.
Internal rekeying has the following advantages:

it increases the lifetime of an initial key by increasing the size of the messages processed with one initial key;

it has minimal impact on performance;

internal rekeying mechanisms without a master key does not affect short messages transformation at all;

it is transparent (works like any mode of operation): does not require changes of IV's and restarting MACing.
However, the use of internal rekeying has the following disadvantages:

a specific method must not be chosen independently of a mode of operation;

internal rekeying mechanisms without a master key do not provide backward security of data processing keys.
Any block cipher modes of operations with internal rekeying can be jointly used with any external
rekeying 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 rekeying transformation
decreases the code size but can lead to some possible vulnerabilities (the possibility of mounting a chosenplaintext attack may lead to the compromise of the following keys).
This vulnerability can be eliminated by using different primitives for
data processing and rekeying, e.g., block cipher for data processing and hash for rekeying (see and ).
However, in this case the security of the whole scheme cannot be reduced
to standard notions like PRF or PRP, so security estimations become more difficult and unclear.
Summing up the abovementioned issues briefly:

If a protocol assumes processing long records (e.g., ), internal rekeying should be used.
If a protocol assumes processing a significant amount of ordered records, which can be
considered as a single data stream (e.g., , ), internal rekeying may also be used.

For protocols which allow outoforder delivery and lost records (e.g., , ) external
rekeying should be used as in this case records cannot be considered as a single data stream. If at the same time records are long enough, internal rekeying
should be additionally used during each separate message processing.
For external rekeying:

If it is desirable to separate transformations used for data processing and for key update,
hash function based rekeying should be used.

If parallel data processing is required, then parallel external rekeying should be used.

In case of restrictive key lifetime limitations external treebased rekeying should be used.
For internal rekeying:

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 rekeying with a master key should be used.
External Rekeying Mechanisms
This section presents an approach to increase the initial key lifetime by using
a transformation of a data processing key (frame key) after processing a limited number of entire messages (frame).
It provides external parallel and serial rekeying mechanisms (see ).
These mechanisms use initial key K only for frame keys 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 rekeying" mechanisms in this document.
External rekeying 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 rekeying 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 sidechannel analysis methods (sidechannel 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.
Let L = min(L1, L2), q = min (q1, q2), q * m <= L. As L1 limitation is usually much stronger than L2 limitation (L1 < L2), the final key lifetime restriction
is equal to the most restrictive limitation L1. Thus, as displayed in Figure 2, without rekeying only q1 (q1 * m <= L1) messages can be safely processed.
++ ^ ^
================  
================  
K>================ q1
================  
==============L1  
++ v 
  
  
  q2
  
  
  
  
  
  
  
  
 L2 
++ v
Figure 2: Basic principles of message processing without
external rekeying
]]>
Suppose that the safety margin for the protocol P is fixed and the external rekeying 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 goes 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 ) that the security of the mode of operation that uses external rekeying leads to an increase when compared to base mode
without rekeying (thus, L2 < L2'). Hence, as displayed in Figure 3, the resulting key lifetime limitation in case of using external rekeying can be increased up to L2'.
K ++
 ================
v ================
K^1> ================
 ================
 ==============L1
 ++
 ================
v ================
K^2> ================
 ================
 ==============L1
 ++
 ================
v ================
...  . . . 
 
 
 L2
++
 
... ...
 L2'
++
Figure 3: Basic principles of message processing
with external rekeying
]]>
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 rekeying mechanism is not used, the initial key K must be
renegotiated after processing 128 MB / 1 KB = 131072 messages.
If an external rekeying mechanism is used,
the key lifetime limitation L1 goes off. Hence the resulting key lifetime limitation L2' can be set to more then 1 TB.
Thus if an external rekeying mechanism is used, more then 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 external rekeying mechanism is not used.
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 Figure 4 and Figure 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 to use the frame key K^i in almost optimal way
but it can be applied only in case 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 in case 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 () 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 wish the adversary not to detect the key change during the protocol evaluation.
Parallel Constructions
External parallel rekeying mechanisms generate frame keys K^1, K^2, ... directly from the initial key K independently of each other.
The main idea behind external rekeying with a parallel construction is presented in Figure 4:
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 rekeying mechanisms
]]>
The frame key K^i, i = 1, ... , t1, is updated after processing a certain amount of messages (see ).
Parallel Construction Based on a KDF on a Block Cipher
ExtParallelC rekeying 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).
Parallel Construction Based on a KDF on a Hash Function
ExtParallelH rekeying mechanism is based on the key derivation function HKDFExpand, described
in , and is used to generate t frame keys as follows:

K^1  K^2  ...  K^t = ExtParallelH(K, t * k) = HKDFExpand(K, label, t * k),
where label is a string (may be a zerolength string) that is defined by a specific protocol.
Treebased Construction
The application of external treebased mechanism leads to the construction
of the key tree with the initial key K (root key) at the 0level and the frame keys K^1, K^2, ... at the last level as described in Figure 5.
The tree height h and the number of keys Wj, j in {1, ... , h}, which can be partitioned from "parent" key, are defined in accordance
with a specific protocol and key lifetime limitations for the used derivation functions.
Each jlevel key K{j,w}, where j in {1, ... , h}, w in {1, ... , W1 * ... * Wj}, is derived from the (j1)level "parent" key K{j1,ceil(w/Wi)}
(and other appropriate input data) using the jth level derivation function that can be based on the block cipher function
or on the hash function and that is defined in accordance with a specific protocol.
The ith frame K^i, i in {1, 2, ... , W1*...*Wh}, can be calculated as follows:

K^i = ExtKeyTree(K, i) = KDF_h(KDF_{h1}(... KDF_1(K, ceil(i / (W2 * ... * Wh)) ... , ceil(i / Wh)), i),
where KDF_j is the jth level derivation function that takes two arguments
(the parent key value and the integer in range from 1 to W1 * ... * Wj) and outputs the jth level key value.
The frame key K^i is updated after processing a certain amount of messages (see ).
In order to create an efficient implementation, during frame key K^i generation the derivation functions KDF_j, j in {1, ... , h1}, should be used only in case when ceil(i / (W{j+1} * ... * Wh)) != ceil((i  1) / (W{j+1} * ... * Wh));
otherwise it is necessary to use previously generated value. This approach also makes it possible to take countermeasures against side channels 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 . 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}.
The structure similar to external treebased mechanism can be found in Section 6 of .
Serial Constructions
External serial rekeying mechanisms generate frame keys,
each of which depends on the secret state (K*_1, K*_2, ..., see Figure 6) that is updated after the generation of each new frame key.
Similar approaches are used in the protocol, in the updating traffic keys mechanism and
were proposed for use in the protocol.
External serial rekeying mechanisms have the obvious disadvantage of the impossibility to be implemented in parallel,
but they can be preferred if additional forward secrecy is desirable: in case all keys are securely deleted after usage,
compromise of a current secret state at some time does not lead to a compromise of all previous secret states and frame keys.
In terms of , compromise of application_traffic_secret_N does not compromise all previous application_traffic_secret_i, i < N.
The main idea behind external rekeying with a serial construction is presented in Figure 6:
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 rekeying mechanisms
]]>
The frame key K^i, i = 1, ... , t  1, is updated after processing a certain amount of messages (see ).
Serial Construction Based on a KDF on a Block Cipher
The frame key K^i is calculated using 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.
Serial Construction Based on a KDF on a Hash Function
The frame key K^i is calculated using ExtSerialH transformation as follows:

K^i = ExtSerialH(K, i) = HKDFExpand(K*_i, label1, k),
where i = 1, ... , t, HKDFExpand is the HMACbased key derivation function, described in , K*_i is calculated as follows:

K*_1 = K,

K*_{j+1} = HKDFExpand(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, TLS 1.3 updating traffic keys algorithm ).
Using Additional Entropy during Rekeying
In many cases using additional entropy during rekeying 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 for using additional entropy with external rekeying mechanisms based on secure KDFs.
However, in some situations mixedin entropy can still increase security in the case of a timelimited but
complete breach of the system, when an adversary can access the frame keys generation interface,
but cannot reveal master keys (e.g., when master keys are stored in an HSM).
For example, an external parallel construction based on a KDF on a Hash function with a mixedin entropy can be described as follows:

K^i = HKDFExpand(K, label_i, k),
where label_i is additional entropy that must be sent to the recipient (e.g., be sent jointly with encrypted message).
The entropy label_i and the corresponding key K^i must be generated directly before message processing.
Internal Rekeying Mechanisms
This section presents an approach to increase the key lifetime by using a transformation of a data processing key (section key)
during each separate message processing. Each message is processed starting with the same key (the first section key)
and each section key is updated after processing N bits of message (section).
This section provides internal rekeying mechanisms called ACPKM (Advanced Cryptographic Prolongation of Key Material) and ACPKMMaster
that do not use a master key and use a master key respectively.
Such mechanisms are integrated into the base modes of operation
and actually form new modes of operation, therefore
they are called "internal rekeying" mechanisms in this document.
Internal rekeying mechanisms are recommended to be used in protocols
that process large single messages (e.g., CMS messages), since the
maximum gain in increasing the key lifetime is achieved by increasing the length of a message,
while it provides almost no increase in the number of messages that can be processed with one initial key.
Internal rekeying increases the key lifetime through the following approach.
Suppose protocol P uses some base mode of operation.
Let L1 and L2 be a side channel and combinatorial limitations respectively and
for some fixed amount of messages q let m1, m2 be the lengths of messages,
that can be safely processed with a single initial key K according to these limitations.
Thus, by analogy with the without rekeying the final key lifetime restriction, as displayed in Figure 7,
is equal to L1 and only q messages of the length m1 can be safely processed.
<m2>
Figure 7: Basic principles of message processing
without internal rekeying
]]>
Suppose that the safety margin for the protocol P is fixed and internal rekeying approach is applied to the base mode of operation.
Suppose further that every message is processed with a section key, which is transformed after processing N bits of data, where N is a parameter.
If q * N does not exceed L1 then the side channel limitation L1 goes off and the resulting key lifetime limitation of the initial key K can be calculated
on the basis of a new combinatorial limitation L2'. The security of the mode of operation that uses internal rekeying increases when compared to base mode of operation
without rekeying (thus, L2 < L2'). Hence, as displayed in Figure 8, the resulting key lifetime limitation in case of using internal rekeying can be increased up to L2'.
K^1> K^2 > . . .
 
v v
^ ++++...+
 =============L1=============L1====== L2 L2’
 ====================================  
q ==================================== . . .  
 ====================================  
 ====================================  
v ++++...+
<N>
Figure 8: Basic principles of message processing
with internal rekeying
]]>
Note: the key transformation process is depicted in a simplified form.
A specific approach (ACPKM and ACPKMMaster rekeying mechanisms) is described below.
Since the performance of encryption can slightly decrease for rather
small values of N, the parameter N should be selected for a
particular protocol as maximum possible to provide necessary key
lifetime for the considered security models.
Consider an example. Suppose L1 = 128 MB and L2 = 10 TB.
Let the message size in the protocol be large/unlimited (may exhaust the whole key lifetime L2).
The most restrictive resulting key lifetime limitation is equal to 128 MB.
Thus, there is a need to put a limit on the maximum message size m_max. For example, if m_max = 32 MB, it may happen
that the renegotiation of initial key K would be required after processing only four messages.
If an internal rekeying mechanism with section size N = 1 MB is used, more than L1 / N = 128 MB / 1 MB = 128
messages can be processed before the renegotiation of initial key K (instead of 4 messages in case when an internal rekeying mechanism is not used).
Note that only one section of each message is processed with the section key K^i, and, consequently, the key lifetime limitation L1 goes off.
Hence the resulting key lifetime limitation L2' can be set to more then 10 TB (in the case when a single large message is processed using the initial key K).
Methods of Key Lifetime Control
Suppose L is an amount of data that can be safely processed with one section key,
N is a section size (fixed parameter).
Suppose M^{i}_1 is the first section of message M^{i}, i = 1, ... , q (see Figure 9 and Figure 10),
then the parameter q can be calculated in accordance with one of the following two approaches:

Explicit approach:
q_i is such that M^{1}_1 + ... + M^{q}_1 <= L, M^{1}_1 + ... + M^{q+1}_1 > L
This approach allows to use the section key K^i in an almost optimal way
but it can be applied only in case when messages cannot be lost or reordered (e.g., TLS records).

Implicit approach:
q = L / N.
The amount of data processed with one section key K^i is calculated under the assumption that the length of every message is equal or greater than section size N
and so it can be considerably less than the key lifetime limitation L. On the other hand, this approach
can be applied in case when messages may be lost or reordered (e.g., DTLS records).
Constructions that Do Not Require Master Key
This section describes the block cipher modes that use the ACPKM
rekeying mechanism, which
does not use a master key: an initial key is used directly for the data encryption.
ACPKM Rekeying Mechanisms
This section defines periodical key transformation without a master key, which is
called ACPKM rekeying mechanism. This mechanism can be applied to one of the
base encryption modes (CTR and GCM block cipher modes)
for getting an extension of this encryption mode that uses periodical key
transformation without a master key. This extension can be considered as a new encryption mode.
An additional parameter that defines functioning of base encryption modes
with the ACPKM rekeying mechanism is the section size N.
The value of N is measured in bits and is fixed within a specific protocol based on the requirements of the system
capacity and the key lifetime.
The section size N MUST be divisible by the block size n.
The main idea behind internal rekeying without a master key is presented in Figure 9:
K^2 ...> K^{l_max1} > K^{l_max}
   
   
v v v v
M^{1} ==================== ... =================: 
M^{2} ==================== ... ===  : 
. . . . . . :
: : : : : : :
M^{q} ==================== ... =============== : 
section :
<> m_max
N bit
___________________________________________________________________
l_max = ceil(m_max/N).
Figure 9: Internal rekeying without a master key
]]>
During the processing of the input message M with the length m in some encryption mode that
uses ACPKM key transformation of the initial key K the message is divided into l = ceil(m / N) sections
(denoted as M = M_1  M_2  ...  M_l, where M_i is in V_N for i in {1, 2, ... , l  1} and M_l is in V_r, r <= N).
The first section of each message is processed with the section key K^1 = K. To process the (i + 1)th section of each message the section key K^{i+1}
is calculated using ACPKM transformation as follows:

K^{i+1} = ACPKM(K^i) = MSB_k(E_{K^i}(D_1)  ...  E_{K^i}(D_J)),
where J = ceil(k/n) and D_1, D_2, ... , D_J are in V_n and are calculated as follows:

D_1  D_2  ...  D_J = MSB_{J * n}(D),
where D is the following constant in V_{1024}:
N o t e : The constant D is such that D_1, ... , D_J are pairwise different for any allowed n and k values.
N o t e : The highest bit of each octet of the constant D is equal to 1.
This condition is important, as in conjunction with a certain mode message length limitation it allows to prevent collisions of block cipher permutation inputs
in cases of key transformation and message processing (for more details see Section 4.4 of ).
CTRACPKM Encryption Mode
This section defines a CTRACPKM encryption mode that uses the ACPKM internal rekeying
mechanism for the periodical key transformation.
The CTRACPKM mode can be considered as the base encryption mode CTR (see ) extended by the ACPKM rekeying mechanism.
The CTRACPKM encryption mode can be used with the following parameters:
 64 <= n <= 512;
 128 <= k <= 512;

the number c of bits in a specific part of the block to be incremented
is such that 32 <= c <= 3 / 4 n, c is a multiple of 8;

the maximum message size m_max = n * 2^{c1}.
The CTRACPKM mode encryption and decryption procedures are defined as follows:
The initial counter nonce ICN value for each message that is encrypted under the given initial key K must be
chosen in a unique manner.
GCMACPKM Authenticated Encryption Mode
This section defines GCMACPKM authenticated encryption mode that uses the ACPKM internal rekeying mechanism for the periodical key transformation.
The GCMACPKM mode can be considered as the base authenticated encryption mode GCM (see ) extended by the ACPKM rekeying mechanism.
The GCMACPKM authenticated encryption mode can be used with the following parameters:
 n in {128, 256};
 128 <= k <= 512;

the number c of bits in a specific part of the block to be incremented
is such that 1 / 4 n <= c <= 1 / 2 n, c is a multiple of 8;

authentication tag length t;

the maximum message size m_max = min{n * (2^{c1}  2), 2^{n/2}  1}.
The GCMACPKM mode encryption and decryption procedures are defined as follows:
The * operation on (pairs of) the 2^n possible blocks corresponds to the multiplication operation
for the binary Galois (finite) field of 2^n elements defined by the polynomial f as follows (by analogy with ):
 n = 128:

f = a^128 + a^7 + a^2 + a^1 + 1,
 n = 256:

f = a^256 + a^10 + a^5 + a^2 + 1.
The initial counter nonce ICN value for each message that is encrypted under the given initial key K must be
chosen in a unique manner.
The key for computing values E_{K}(ICB_0) and H is not updated and is
equal to the initial key K.
Constructions that Require Master Key
This section describes the block cipher modes that use the ACPKMMaster
rekeying mechanism, which
use the initial key K as a master key, so K is never used directly for data processing but is
used for key derivation.
ACPKMMaster Key Derivation from the Master Key
This section defines periodical key transformation with a master key, which is
called ACPKMMaster rekeying mechanism. This mechanism can be applied to one of the base modes of operation (CTR, GCM, CBC, CFB, OMAC modes)
for getting an extension that uses periodical key transformation with a master key. This extension can be considered as a new mode of operation.
Additional parameters that define the functioning of modes of operation
that use the ACPKMMaster rekeying mechanism are the section size N, the change frequency T* of the master keys K*_1, K*_2, ... (see Figure 10) and the size d of the section key material.
The values of N and T* are measured in bits and are fixed within a specific protocol, based on the requirements of the system
capacity and the key lifetime.
The section size N MUST be divisible by the block size n. The master key frequency T* MUST be divisible by d and by n.
The main idea behind internal rekeying with a master key is presented in Figure 10:
K*_2 ...> K*_l_max
______ ______ ______
     
v ... v v ... v v ... v
K[1] K[t] K[t+1] K[2*t] K[(l_max1)t+1] K[l_max*t]
     
     
v v v v v v
M^{1}======...============...======...======...== : 
M^{2}======...============...======...======...====: 
...           : 
M^{q}======...========== ... ... ... : 
section :
<> :
N bit m_max
_____________________________________________________________________
K[i] = d,
t = T* / d,
l_max = ceil(m_max / (N * t)).
Figure 10: Internal rekeying with a master key
]]>
During the processing of the input message M with the length m in some mode of operation that
uses ACPKMMaster key transformation with the initial key K and the master key frequency T*
the message M is divided into l = ceil(m / N) sections (denoted as M = M_1  M_2  ...  M_l, where M_i is in V_N
for i in {1, 2, ... , l  1} and M_l is in V_r, r <= N). The jth section of each message is processed
with the key material K[j], j in {1, ... , l}, K[j] = d, that is calculated with the ACPKMMaster algorithm as follows:

K[1]  ...  K[l] = ACPKMMaster(T*, K, d, l) = CTRACPKMEncrypt (T*, K, 1^{n/2}, 0^{d*l}).
Note: the parameters d and l MUST be such that d * l <= n * 2^{n/21}.
CTRACPKMMaster Encryption Mode
This section defines a CTRACPKMMaster encryption mode that uses the ACPKMMaster internal rekeying
mechanism for the periodical key transformation.
The CTRACPKMMaster encryption mode can be considered as the base encryption mode CTR (see ) extended by the ACPKMMaster rekeying mechanism.
The CTRACPKMMaster encryption mode can be used with the following parameters:
 64 <= n <= 512;
 128 <= k <= 512;

the number c of bits in a specific part of the block to be incremented
is such that 32 <= c <= 3 / 4 n, c is a multiple of 8;

the maximum message size m_max = min{N * (n * 2^{n/21} / k), n * 2^c}.
The key material K[j] that is used for one section processing is equal to K^j, K^j = k bits.
The CTRACPKMMaster mode encryption and decryption procedures are defined as follows:
The initial counter nonce ICN value for each message that is encrypted under the given initial key must be
chosen in a unique manner.
GCMACPKMMaster Authenticated Encryption Mode
This section defines a GCMACPKMMaster authenticated encryption mode that uses the ACPKMMaster internal rekeying
mechanism for the periodical key transformation.
The GCMACPKMMaster authenticated encryption mode can be considered as the base authenticated encryption mode GCM (see ) extended by the ACPKMMaster rekeying mechanism.
The GCMACPKMMaster authenticated encryption mode can be used with the following parameters:
 n in {128, 256};
 128 <= k <= 512;

the number c of bits in a specific part of the block to be incremented
is such that 1 / 4 n <= c <= 1 / 2 n, c is a multiple of 8;

authentication tag length t;

the maximum message size m_max = min{N * ( n * 2^{n/21} / k), n * (2^c  2), 2^{n/2}  1}.
The key material K[j] that is used for the jth section processing is equal to K^j, K^j = k bits.
The GCMACPKMMaster mode encryption and decryption procedures are defined as follows:
The * operation on (pairs of) the 2^n possible blocks corresponds to the multiplication operation
for the binary Galois (finite) field of 2^n elements defined by the polynomial f as follows (by analogy with ):
 n = 128:

f = a^128 + a^7 + a^2 + a^1 + 1,
 n = 256:

f = a^256 + a^10 + a^5 + a^2 + 1.
The initial counter nonce ICN value for each message that is encrypted under the given initial key must be
chosen in a unique manner.
CBCACPKMMaster Encryption Mode
This section defines a CBCACPKMMaster encryption mode that uses the ACPKMMaster internal rekeying
mechanism for the periodical key transformation.
The CBCACPKMMaster encryption mode can be considered as the base encryption mode CBC (see ) extended by the ACPKMMaster rekeying mechanism.
The CBCACPKMMaster encryption mode can be used with the following parameters:
 64 <= n <= 512;
 128 <= k <= 512;

the maximum message size m_max = N * (n * 2^{n/21} / k).
In the specification of the CBCACPKMMaster mode the plaintext and ciphertext must be a sequence of one or more complete data blocks.
If the data string to be encrypted does not initially satisfy this property, then it MUST be padded to form complete data blocks.
The padding methods are out of the scope of this document. An example of a padding method can be found in Appendix A of .
The key material K[j] that is used for the jth section processing is equal to K^j, K^j = k bits.
We will denote by D_{K} the decryption function which is a permutation inverse to E_{K}.
The CBCACPKMMaster mode encryption and decryption procedures are defined as follows:
The initialization vector IV for any particular execution of the encryption process must be unpredictable.
CFBACPKMMaster Encryption Mode
This section defines a CFBACPKMMaster encryption mode that uses the ACPKMMaster internal rekeying
mechanism for the periodical key transformation.
The CFBACPKMMaster encryption mode can be considered as the base encryption mode CFB (see ) extended by the ACPKMMaster rekeying mechanism.
The CFBACPKMMaster encryption mode can be used with the following parameters:
 64 <= n <= 512;
 128 <= k <= 512;

the maximum message size m_max = N * (n * 2^{n/21} / k).
The key material K[j] that is used for the jth section processing is equal to K^j, K^j = k bits.
The CFBACPKMMaster mode encryption and decryption procedures are defined as follows:
The initialization vector IV for any particular execution of the encryption process must be unpredictable.
OMACACPKMMaster Authentication Mode
This section defines an OMACACPKMMaster message authentication code calculation mode that uses the ACPKMMaster internal rekeying
mechanism for the periodical key transformation.
The OMACACPKMMaster mode can be considered as the base message authentication code calculation mode OMAC, which is also known as CMAC (see ), extended by the ACPKMMaster rekeying mechanism.
The OMACACPKMMaster message authentication code calculation mode can be used with the following parameters:
 n in {64, 128, 256};
 128 <= k <= 512;

the maximum message size m_max = N * (n * 2^{n/21} / (k + n)).
The key material K[j] that is used for one section processing is equal to K^j  K^j_1, where K^j = k and K^j_1 = n.
The following is a specification of the subkey generation process of OMAC:
Here R_n takes the following values:
 n = 64: R_{64} = 0^{59}  11011;
 n = 128: R_{128} = 0^{120}  10000111;
 n = 256: R_{256} = 0^{145}  10000100101.
The OMACACPKMMaster message authentication code calculation mode is defined as follows:
Joint Usage of External and Internal Rekeying
Both external rekeying and internal rekeying have their own advantages and disadvantages discussed in .
For instance, using external rekeying can essentially limit the message length, while in the case of internal rekeying
the section size, which can be chosen as the maximal possible for operational properties, limits the amount of separate messages.
Therefore, the choice of rekeying mechanism (either external or internal) depends on particular protocol features.
However, some protocols may have features that require to take advantages provided by both external and internal rekeying mechanisms:
for example, the protocol mainly transmits messages of small length, but it must additionally support very long messages processing.
In such situations it is necessary to use external and internal rekeying jointly, since these techniques negate each other's disadvantages.
For composition of external and internal rekeying techniques any mechanism described in can be used with any mechanism described in .
For example, consider the GCMACPKM mode with external serial rekeying
based on a KDF on a Hash function. Denote by a frame size the number of messages in each frame
(in the case of implicit approach to the key lifetime control) for external rekeying.
Let L be a key lifetime limitation. The section size N for internal rekeying and
the frame size q for external rekeying must be chosen in such a way
that q * N must not exceed L.
Suppose that t messages (ICN_i, P_i, A_i), with initial counter nonce ICN_i, plaintext P_i and
additional authenticated data A_i, will be processed before renegotiation.
For authenticated encryption of each message (ICN_i, P_i, A_i), i = 1, ..., t, the following
algorithm can be applied:
Note that nonces ICN_i, that are used under the same frame key, must be unique for each message.
Security Considerations
Rekeying should be used to increase "a priori" security properties of ciphers in hostile environments (e.g., with sidechannel adversaries).
If some efficient attacks are known for a cipher, it must not be used. So rekeying cannot be used as a patch for vulnerable ciphers.
Base cipher properties must be well analyzed, because the security of rekeying mechanisms is based on the security of a block cipher as a pseudorandom function.
Rekeying is not intended to solve any postquantum security issues for symmetric cryptography,
since the reduction of security caused by Grover's algorithm is not connected with a size
of plaintext transformed by a cipher  only a negligible (sufficient for key uniqueness)
material is needed; and the aim of rekeying is to limit a size of plaintext transformed under one initial key.
Rekeying can provide backward security only if previous key material is securely deleted after usage by all parties.
IANA Considerations
This document does not require any IANA actions.
References
Normative References
Key words for use in RFCs to Indicate Requirement Levels
In many standards track documents several words are used to signify the requirements in the specification. These words are often capitalized. This document defines these words as they should be interpreted in IETF documents. This document specifies an Internet Best Current Practices for the Internet Community, and requests discussion and suggestions for improvements.
The AESCMAC Algorithm
The National Institute of Standards and Technology (NIST) has recently specified the Cipherbased Message Authentication Code (CMAC), which is equivalent to the OneKey CBC MAC1 (OMAC1) submitted by Iwata and Kurosawa. This memo specifies an authentication algorithm based on CMAC with the 128bit Advanced Encryption Standard (AES). This new authentication algorithm is named AESCMAC. The purpose of this document is to make the AESCMAC algorithm conveniently available to the Internet Community. This memo provides information for the Internet community.
HMACbased ExtractandExpand Key Derivation Function (HKDF)
This document specifies a simple Hashed Message Authentication Code (HMAC)based key derivation function (HKDF), which can be used as a building block in various protocols and applications. The key derivation function (KDF) is intended to support a wide range of applications and requirements, and is conservative in its use of cryptographic hash functions. This document is not an Internet Standards Track specification; it is published for informational purposes.
Guidelines on the Cryptographic Algorithms to Accompany the Usage of Standards GOST R 34.102012 and GOST R 34.112012
The purpose of this document is to make the specifications of the cryptographic algorithms defined by the Russian national standards GOST R 34.102012 and GOST R 34.112012 available to the Internet community for their implementation in the cryptographic protocols based on the accompanying algorithms.
These specifications define the pseudorandom functions, the key agreement algorithm based on the DiffieHellman algorithm and a hash function, the parameters of elliptic curves, the key derivation functions, and the key export functions.
Recommendation for Key Derivation Using Pseudorandom Functions
National Institute of Standards and Technology
Datagram Transport Layer Security Version 1.2
This document specifies version 1.2 of the Datagram Transport Layer Security (DTLS) protocol. The DTLS protocol provides communications privacy for datagram protocols. The protocol allows client/server applications to communicate in a way that is designed to prevent eavesdropping, tampering, or message forgery. The DTLS protocol is based on the Transport Layer Security (TLS) protocol and provides equivalent security guarantees. Datagram semantics of the underlying transport are preserved by the DTLS protocol. This document updates DTLS 1.0 to work with TLS version 1.2. [STANDARDSTRACK]
Cryptographic Message Syntax (CMS)
This document describes the Cryptographic Message Syntax (CMS). This syntax is used to digitally sign, digest, authenticate, or encrypt arbitrary message content. [STANDARDSTRACK]
The Secure Shell (SSH) Transport Layer Protocol
The Secure Shell (SSH) is a protocol for secure remote login and other secure network services over an insecure network.
This document describes the SSH transport layer protocol, which typically runs on top of TCP/IP. The protocol can be used as a basis for a number of secure network services.
It provides strong encryption, server authentication, and integrity protection. It may also provide compression.
Key exchange method, public key algorithm, symmetric encryption algorithm, message authentication algorithm, and hash algorithm are all negotiated.
This document also describes the DiffieHellman key exchange method and the minimal set of algorithms that are needed to implement the SSH transport layer protocol. [STANDARDSTRACK]
IP Encapsulating Security Payload (ESP)
This document describes an updated version of the Encapsulating Security Payload (ESP) protocol, which is designed to provide a mix of security services in IPv4 and IPv6. ESP is used to provide confidentiality, data origin authentication, connectionless integrity, an antireplay service (a form of partial sequence integrity), and limited traffic flow confidentiality. This document obsoletes RFC 2406 (November 1998). [STANDARDSTRACK]
The Transport Layer Security (TLS) Protocol Version 1.3
This document specifies version 1.3 of the Transport Layer Security (TLS) protocol. TLS allows client/server applications to communicate over the Internet in a way that is designed to prevent eavesdropping, tampering, and message forgery.
This document updates RFCs 5705 and 6066, and obsoletes RFCs 5077, 5246, and 6961. This document also specifies new requirements for TLS 1.2 implementations.
Recommendation for Block Cipher Modes of Operation: Galois/Counter Mode (GCM) and GMAC
Dworkin, M.
Recommendation for Block Cipher Modes of Operation: Methods and Techniques
Dworkin, M.
Informative References
Retail Financial Services Symmetric Key Management  Part 3: Derived Unique Key Per Transaction
ANSI
Increasing the Lifetime of a Key: A Comparative Analysis of the Security of Rekeying Techniques
Michel Abdalla and Mihir Bellare
On the Practical (In)Security of 64bit Block Ciphers: Collision Attacks on HTTP over TLS and OpenVPN
Karthikeyan Bhargavan, Gaëtan Leurent
TEMPEST attacks against AES. Covertly stealing keys for 200 euro
By Craig Ramsay, Jasper Lohuis
A Tutorial on Linear and Differential Cryptanalysis
Howard M. Heys
The Double Ratchet Algorithm
Dynamic Key Changes on Encrypted Sessions
Peter Alexander
On Making U2F Protocol LeakageResilient via Rekeying.
Key Updating for Leakage Resiliency With Application to AES Modes of Operation
A LeakageResilient Mode of Operation
Practical LeakageResilient Symmetric Cryptography
How to Construct Random Functions
Key Regression: Enabling Efficient Key Distribution for Secure Distributed Storage
Secure Group Services for Storage Area Networks
OneWay CrossTrees and Their Applications
Towards Sound Fresh ReKeying with Hard (Physical) Learning Problems
Increasing the Lifetime of Symmetric Keys for the GCM Mode by Internal Rekeying
Test Examples
Test Examples for External Rekeying
External Rekeying with a Parallel Construction
External Rekeying with a Serial Construction
Test Examples for Internal Rekeying
Internal Rekeying Mechanisms that Do Not Require Master Key
Internal Rekeying Mechanisms with a Master Key
K2 = K1 << 1
K1:
00000: 78 21 C7 C7 6C BD 79 63 56 AC F8 8E 69 6A 00 07
K2:
00000: F0 43 8F 8E D9 7A F2 C6 AD 59 F1 1C D2 D4 00 0E
Plaintext M_5:
00000: 33 44 55 66 77 88 99 AA BB CC EE FF 0A 00 11 22
Using K1, padding is not required
Input block M_5 (xor) C_4:
00000: FD E6 71 37 E6 05 2D 8F 94 A1 9D 55 60 E8 0C A4
Output block C_5:
00000: B3 AD B8 92 18 32 05 4C 09 21 E7 B8 08 CF A0 B8
Message authentication code T:
00000: B3 AD B8 92 18 32 05 4C 09 21 E7 B8 08 CF A0 B8
]]>
Contributors

Russ Housley
Vigil Security, LLC
housley@vigilsec.com

Evgeny Alekseev
CryptoPro
alekseev@cryptopro.ru

Ekaterina Smyshlyaeva
CryptoPro
ess@cryptopro.ru

Shay Gueron
University of Haifa, Israel
Intel Corporation, Israel Development Center, Israel
shay.gueron@gmail.com

Daniel Fox Franke
Akamai Technologies
dfoxfranke@gmail.com

Lilia Ahmetzyanova
CryptoPro
lah@cryptopro.ru
Acknowledgments
We thank Mihir Bellare, Scott Fluhrer, Dorothy Cooley, Yoav Nir, Jim Schaad, Paul Hoffman, Dmitry Belyavsky, Yaron Sheffer, Alexey Melnikov and Spencer Dawkins
for their useful comments.