Jump to content

Key encapsulation mechanism

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Taylor Riastradh Campbell (talk | contribs) at 22:50, 20 July 2024 (Add a formal definition with some older and newer references.). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

In cryptography, a key encapsulation mechanism, or KEM, is a public-key cryptosystem that allows a sender to generate a short secret key and transmit it to a receiver securely, in spite of eavesdropping and intercepting adversaries.[1][2][3][4]

A KEM allows a sender who knows a public key to simultaneously generate a short random secret key and an encapsulation or ciphertext of the secret key by the KEM's encapsulation algorithm. The receiver who knows the private key corresponding to the public key can recover the same random secret key from the encapsulation by the KEM's decapsulation algorithm.[1][2][3]

The security goal of a KEM is to prevent anyone who doesn't know the private key from recovering any information about the encapsulated secret keys, even after eavesdropping or submitting other encapsulations to the receiver to study how the receiver reacts.[1][2][3]

Difference from public-key encryption

The difference between a public-key encryption scheme and a KEM is that a public-key encryption scheme allows a sender to choose an arbitrary message from some space of possible messages, while a KEM chooses a short secret key at random for the sender.[1][2][3]

The sender may take the random secret key produced by a KEM and use it as a symmetric key for an authenticated cipher whose ciphertext is sent alongside the encapsulation to the receiver. This serves to compose a public-key encryption scheme out of a KEM and a symmetric-key authenticated cipher in a hybrid cryptosystem.[1][2][3][5]

Most public-key encryption schemes such as RSAES-PKCS1-v1_5, RSAES-OAEP, and Elgamal encryption are limited to small messages[6][7] and are almost always used to encrypt a short random secret key in a hybrid cryptosystem anyway.[8][9][5] And although a public-key encryption scheme can conversely be converted to a KEM by choosing a random secret key and encrypting it as a message, it is easier to design and analyze a secure KEM than to design a secure public-key encryption scheme as a basis. So most modern public-key encryption schemes are based on KEMs rather than the other way around.[10][5]

Definition

Syntax

A KEM consists of three algorithms:[1][2][3][11][12]

  1. Key generation, , takes no inputs and returns a pair of a public key and a private key .
  2. Encapsulation, , takes a public key , randomly chooses a secret key , and returns along with its encapsulation .
  3. Decapsulation, , takes a private key and an encapsulation , and either returns an encapsulated secret key or fails, sometimes denoted by returning .

Correctness

A KEM is correct if, for any key pair generated by , decapsulating an encapsulation returned by with high probability yields the same key , .[2][3][11][12]

Security: IND-CCA

Security of a KEM is quantified by its indistinguishability against chosen-ciphertext attack, IND-CCA, which is loosely how much better an adversary can do than a coin toss to tell whether, given a random key and an encapsulation, the key is encapsulated by that encapsulation or is an independent random key.[2][3][11][12]

Specifically, in the IND-CCA game:

  1. The key generation algorithm is run to generate .
  2. is revealed to the adversary.
  3. The adversary can query for arbitrary encapsulations of the adversary's choice.
  4. The encapsulation algorithm is run to randomly generate a secret key and encapsulation , and another secret key is generated independently at random.
  5. A fair coin is tossed, giving an outcome .
  6. The pair is revealed to the adversary.
  7. The adversary can again query for arbitrary encapsulations of the adversary's choice, except for .
  8. The adversary returns a guess , and wins the game if .

The IND-CCA advantage of the adversary is , that is, the probability beyond a fair coin toss at correctly distinguishing an encapsulated key from an independently randomly chosen key.

Example using RSA encryption

Using the same notation employed in the RSA article, say Alice has transmitted her public key (n, e) to Bob, while keeping her private key secret, as usual. Bob then wishes to send symmetric key M to Alice. M might be a 128- or 256-bit AES key (suitably padded for security reasons), for example. The key modulus n is typically 2048 bits or more in length, thus much larger than typical symmetric keys. Without suitable padding, if e is small enough that Me < n, then the encryption can be quickly broken using ordinary integer arithmetic.[13]

To avoid such potential weakness, Bob first maps M to a larger integer m, where 1 < m < n, by using an agreed-upon reversible protocol known as a padding scheme, such as OAEP. He then computes the ciphertext c corresponding to:

Alice can recover m from c by using her private key exponent d by the following computation:

Given m, she recovers the original key M by reversing the padding scheme.

With KEM the process is simplified as follows:[14]

Instead of generating a random symmetric key M, Bob first generates a random m with 1 < m < n. He derives his symmetric key M by M = KDF(m), where KDF is a key derivation function, such as a cryptographic hash. He then computes the ciphertext c corresponding to m:

Alice then recovers m from c by using her private key exponent d by the same method as above:

Given m, she can recover the symmetric key M by M = KDF(m).

The KEM eliminates the complexity of the padding scheme and the proofs needed to show that the padding is secure.[15] Note that while M can be calculated from m in the KEM approach, the reverse is not possible, assuming the key derivation function is a secure one-way function. An attacker who somehow recovers M cannot get the plaintext m. With the padding approach, he can. Thus KEM is said to encapsulate the key.

Note that if the same m is used to encapsulate keys for e or more recipients, and the receivers share the same exponent e, but different p, q and n, then one can recover m via the Chinese remainder theorem. Thus, if key encapsulations for several recipients need to be computed, independent values m should be used.

Earlier versions of Transport Layer Security used RSA for key exchange, before they were deprecated in favour of the more efficient elliptic-curve cryptography.[16]

Similar techniques are available for Diffie–Hellman key exchange and other public key methods.[17]

References

  1. ^ a b c d e f Galbraith, Steven (2012). "§23.1.1: The KEM/DEM paradigm". Mathematics of Public-Key Cryptography. Cambridge University Press. pp. 471–478. ISBN 978-1-107-01392-6.
  2. ^ a b c d e f g h Shoup, Victor (May 2000). Preneel, Bart (ed.). Using Hash Functions as a Hedge against Chosen Ciphertext Attack. Advances in Cryptology – EUROCRYPT 2000. Lecture Notes in Computer Science. Vol. 1807. Bruges, Belgium: Springer. pp. 275–288. doi:10.1007/3-540-45539-6_19. ISBN 978-3-540-67517-4.
  3. ^ a b c d e f g h Cramer, Ronald; Shoup, Victor (2003). "Design and Analysis of Practical Public-Key Encryption Schemes Secure against Adaptive Chosen Ciphertext Attack". SIAM Journal on Computing. 33 (1): 167–226. doi:10.1137/S0097539702403773.
  4. ^ FIPS 203 (Draft): Module-Lattice-Based Key-Encapsulation Mechanism Standard (PDF), National Institute of Standards and Technology, 2023-08-24, doi:10.6028/NIST.FIPS.203.ipd
  5. ^ a b c Barnes, R.; Bhargavan, K.; Lipp, B.; Wood, C. (February 2022). Hybrid Public Key Encryption. Internet Engineering Task Force. doi:10.17487/RFC9180. RFC 9180.
  6. ^ Kaliski, B.; Jonsson, J.; Rusch, A. (November 2016). Moriarity, K. (ed.). PKCS #1: RSA Cryptography Specifications Version 2.2. Internet Engineering Task Force. doi:10.17487/RFC8017. RFC 8017.
  7. ^ Menezes, Alfred J.; van Oorschot, Paul C.; Vanstone, Scott A. (October 1996). "8. Public-Key Encryption". Handbook of Applied Cryptography (PDF). CRC Press. pp. 283–319. ISBN 0-8493-8523-7.
  8. ^ Ferguson, Niels; Kohno, Tadayoshi; Schneier, Bruce (2010). "12. RSA". Cryptography Engineering. Wiley. p. 206. ISBN 978-0-470-47424-2.
  9. ^ Callas, J.; Donnerhacke, L.; Finney, H.; Shaw, D.; Thayer, R. (November 2007). OpenPGP Message Format. Internet Engineering Task Force. doi:10.17487/RFC4880. RFC 4880.
  10. ^ "Post-Quantum Cryptography: FAQs". National Institute of Standards and Technology. 2024-07-19. Archived from the original on 2024-06-26. Retrieved 2024-07-20.
  11. ^ a b c Dent, Alexander W. (2002), A Designer’s Guide to KEMs, Cryptology ePrint Archive, International Association for Cryptologic Research
  12. ^ a b c Hofheinz, Dennis; Hövelmanns, Kathrin; Kiltz, Eike (November 2017). Kalai, Yael; Reyzin, Leonid (eds.). A Modular Analysis of the Fujisaki-Okamoto Transformation. Theory of Cryptography – TCC 2017. Lecture Notes in Computer Science. Vol. 10677. Baltimore, MD, United States: Springer. pp. 341–371. doi:10.1007/978-3-319-70500-2_12. ISBN 978-3-319-70499-9.
  13. ^ RSA (algorithm) § Attacks against plain RSA
  14. ^ Key Encapsulation: A New Scheme for Public-Key Encryption XML Security Working Group F2F, May 2009
  15. ^ An OAEP Variant With a Tight Security Proof – Draft 1.0, Jakob Jonsson, 2002
  16. ^ Sullivan, Nick (10 Aug 2018). "A Detailed Look at RFC 8446 (a.k.a. TLS 1.3)". Cloudflare. Archived from the original on 15 Aug 2018.
  17. ^ PSEC-KEM for ECC

See also