title | author | revision | status | date | link-citations | |
---|---|---|---|---|---|---|
KEM-based Hybrid Forward Secrecy for Noise |
|
1 |
unofficial/unstable |
2018-11-17 |
true |
This document describes the "hfs"
modifier for Noise. This modifier adds
KEM-based hybrid forward secrecy to a Noise handshake.
Noise handshakes depend on some Diffie-Hellman function (usually an Elliptic Curve Diffie-Hellman function such as X25519). If this function is broken by future cryptanalysis then previously-recorded traffic could be decrypted.
To hedge against this possibility, one could use a different public-key algorithm to add hybrid forward secrecy, so that both this new algorithm and the DH algorithm would have to be broken to decrypt old traffic. At time of writing, there's some interest in using post-quantum cryptographic algorithms which might be secure against a quantum computer which could break DH.
These post-quantum algorithms often come in the form of a KEM, or Key Encapsulation Mechanism. Unlike a DH algorithm where both parties exchange public keys in any order, a KEM algorithm requires one party to send a ciphertext based on the other party's public key.
This document describes a Noise handshake modifer ("hfs"
) that adds hybrid forward secrecy using a KEM algorithm.
KEM functions are similar to DH functions, but require an exchange of a public key followed by a ciphertext, rather than an exchange of public keys.
The signature for these functions is defined below.
-
GENERATE_KEM_KEYPAIR()
: Generates a new KEM key pair. A KEM key pair consists ofpublic_key
andprivate_key
elements. Apublic_key
represents an encoding of a KEM public key into a byte sequence of lengthKEMPUBLICKEYLEN
. Thepublic_key
encoding details are specific to each set of KEM functions. -
GENERATE_KEM_CIPHERTEXT(public_key)
: Generates both a KEM ciphertext and a KEM output based on the recipient's public key. Aciphertext
represents an encoding of a KEM ciphertext into a byte sequence of lengthKEMCIPHERTEXTLEN
. Akem_output
represents an encoding of a KEM output into a byte sequence of lengthKEMOUTPUTLEN
. Theciphertext
andkem_output
encoding details are specific to each set of KEM functions. -
KEM(key_pair, ciphertext)
: Performs a KEM calculation between the private key inkey_pair
and theciphertext
and returns a KEM output byte sequence of lengthKEMOUTPUTLEN
. Thekem_output
matches the value that was generated byGENERATE_KEM_CIPHERTEXT()
. -
KEMPUBLICKEYLEN
= A constant specifying the size in bytes of KEM public keys. -
KEMCIPHERTEXTLEN
= A constant specifying the size in bytes of KEM ciphertexts. -
KEMOUTPUTLEN
= A constant specifying the size in bytes of KEM outputs.
Two new tokens are introduced by this document:
-
"e1"
= This token directs the sender to callGENERATE_KEM_KEYPAIR()
. The resulting KEM public key is transferred to the recipient as if it was a static DH public key (i.e. usingEncryptAndHash()
if a key is available). -
"ekem1"
= This token directs the sender to callGENERATE_KEM_CIPHERTEXT()
using a previously received KEM public key. The resulting KEM ciphertext is transferred to the recipient as if it was a static DH public key (i.e. usingEncryptAndHash()
if a key is available). On receiving this token, the recipient will callKEM(key_pair, ciphertext)
to derive the samekem_output
as the sender possesses. On sending or receiving this token, the parties callMixKey(kem_output)
.
The "hfs"
pattern modifier adds an "e1"
token directly following the first
occurrence of "e"
, unless there is a DH operation in this same message, in
which case the "hfs"
token is placed directly after this DH (so that the
public key will be encrypted).
The "hfs"
modifier also adds an "ekem1"
token directly following the
first occurrence of "ee"
.
When the "hfs"
modifier is used, the DH name section must contain a KEM
algorithm name directly following the DH algorithm name, separated by a plus sign.
The table below lists some example unmodified patterns on the left, and some HFS patterns on the right:
\newpage
+--------------------------------+--------------------------------------+
| NN: | NNhfs: |
| -> e | -> e, e1 |
| <- e, ee | <- e, ee, ekem1 |
+--------------------------------+--------------------------------------+
| NK: | NKhfs: |
| <- s | <- s |
| ... | ... |
| -> e, es | -> e, es, e1 |
| <- e, ee | <- e, ee, ekem1 |
+--------------------------------+--------------------------------------+
| NX: | NXhfs: |
| -> e | -> e, e1 |
| <- e, ee, s, es | <- e, ee, ekem1, s, es |
+--------------------------------+--------------------------------------+
| XN: | XNhfs: |
| -> e | -> e, e1 |
| <- e, ee | <- e, ee, ekem1 |
| -> s, se | -> s, se |
+--------------------------------+--------------------------------------+
| XK: | XKhfs: |
| <- s | <- s |
| ... | ... |
| -> e, es | -> e, es, e1 |
| <- e, ee | <- e, ee, ekem1 |
| -> s, se | -> s, se |
+--------------------------------+--------------------------------------+
| XX: | XXhfs: |
| -> e | -> e, e1 |
| <- e, ee, s, es | <- e, ee, ekem1, s, es |
| -> s, se | -> s, se |
+--------------------------------+--------------------------------------+
| KN: | KNhfs: |
| -> s | -> s |
| ... | ... |
| -> e | -> e, e1 |
| <- e, ee, se | <- e, ee, ekem1, se |
+--------------------------------+--------------------------------------+
| KK: | KKhfs: |
| -> s | -> s |
| <- s | <- s |
| ... | ... |
| -> e, es, ss | -> e, e1, es, ss |
| <- e, ee, se | <- e, ee, ekem1, se |
+--------------------------------+--------------------------------------+
| KX: | KXhfs: |
| -> s | -> s |
| ... | ... |
| -> e | -> e, e1 |
| <- e, ee, se, s, es | <- e, ee, ekem1, se, s, es |
+--------------------------------+--------------------------------------+
| IN: | INhfs: |
| -> e, s | -> e, e1, s |
| <- e, ee, se | <- e, ekem1, se |
| | |
+--------------------------------+--------------------------------------+
| IK: | IKhfs: |
| <- s | <- s |
| ... | ... |
| -> e, es, s, ss | -> e, es, e1, s, ss |
| <- e, ee, se | <- e, ee, ekem1, se |
| | |
+--------------------------------+--------------------------------------+
| IX: | IXhfs: |
| -> e, s | -> e, e1, s |
| <- e, ee, se, s, es | <- e, ee, ekem1, se, s, es |
| | |
+--------------------------------+--------------------------------------+
\newpage
Postquantum algorithms are an active area of research. This document doesn't list any such algorithms, because it's unclear which algorithms will remain secure into the future (against both quantum and nonquantum attacks).
It's even more unclear how to balance the security strength of these algorithms against performance considerations, and even more unclear which algorithms are likely to become widely-supported.
Due to the Noise key derivation, even using a weak KEM algorithm will not hurt the security of the protocol. However it's difficult to assess how much security current postquantum algorithms provide.
Note that KEM public keys are sometimes sent in clear. If making the handshake indistinguishable from random bytes is a goal, some additional method will have to be used to obscure these values (and the DH ephemeral public keys).
KEM public keys and ciphertexts are encrypted when possible because:
-
This maintains consistency with current Noise behavior, which is to encrypt everything except the ephemeral DH public keys.
-
This behavior for tokens makes it easier to obscure the type of protocol being executed, since more of the handshake is encrypted.
-
This behavior might add other small security benefits (e.g. if an attacker could break some KEM public keys but not all of them, then encrypting the KEM public key might force them to perform an expensive attack against DH to determine if the KEM public key was vulnerable).
This document is hereby placed in the public domain.
This document draws on discussions and an earlier spec from Rhys Weatherley.