EVP_KEM-EC(7SSL)
π EVP_KEM-EC β the OpenSSL manual, but make it cute π
okay bestie so this is EVP_KEM-EC(7SSL) from the OpenSSL manual set, and it's lowkey one of the most satisfying little pages ever because it's just: elliptic curve keytype, but make it encapsulate. β¨
πΈ NAME πΈ
EVP_KEM-EC β the EVP_KEM EC keytype, plus all the algorithm support that comes with it. no cap, that's the whole vibe. π«Ά
π¦ DESCRIPTION π¦
So the EC keytype and all its lil parameters are described over in EVP_PKEY-EC(7) β that's your homework, go read it, I'll wait. π
And for the actual encapsulate/decapsulate tea, you want EVP_PKEY_encapsulate(3) and EVP_PKEY_decapsulate(3). they have the deets.
π EC KEM parameters π
"operation" (OSSL_KEM_PARAM_OPERATION) β <UTF8 string>
This one sets the operating mode, and the OpenSSL EC Key Encapsulation Mechanisms only support one default operation. one. singular. iconic behavior honestly.
"DHKEM"(OSSL_KEM_PARAM_OPERATION_DHKEM) β the default operating mode, and here's what it actually does, bestie, sit down:
The encapsulate function generates an ephemeral keypair. it then produces keymaterial by doing an ECDH key exchange using the ephemeral private key and a supplied recipient public key. then a HKDF operation using that keymaterial and a kem context produces a shared secret. the shared secret and the ephemeral public key get returned. π«
The decapsulate function then takes the recipient private key and the ephemeral public key to produce the same keymaterial, which can then be used to produce the same shared secret. it's giving symmetry. it's giving matching friendship bracelets. π
See <https://www.rfc-editor.org/rfc/rfc9180.html#name-dh-based-kem-dhkem> for the full lore.
You can set this using either EVP_PKEY_CTX_set_kem_op() or EVP_PKEY_CTX_set_params(). two doors, same room. pick your fave. πͺ
"ikme" (OSSL_KEM_PARAM_IKME) β <octet string>
This is the key material used for generation of the ephemeral key. β¨
β οΈ bestie this one matters: this value should not be reused for other purposes. i'm so serious. don't be out here recycling your ikme.
It can only be used for the curves "P-256", "P-384" and "P-521", and it should have a length of at least the size of the encoded private key β that's 32, 48 and 66 for the listed curves, in that order, queen. π
If this value is not set, then a random ikm is used. so like, no stress, it's got a fallback. π
π CONFORMING TO π
look at her, standards-compliant AND gorgeous. π
π SEE ALSO π
EVP_PKEY_CTX_set_kem_op(3)EVP_PKEY_encapsulate(3)EVP_PKEY_decapsulate(3)EVP_KEYMGMT(3)EVP_PKEY(3)provider-keymgmt(7)
the whole friend group, fr fr. π«Ά
π HISTORY π
This functionality was added in OpenSSL 3.2. π
The "operation" (operating mode) was a required parameter prior to OpenSSL 3.5. so like, before 3.5 you had to say it out loud. As of OpenSSL 3.5, "DHKEM" is the default operating mode, and no explicit value need be specified. glow-up behavior. β¨
βοΈ COPYRIGHT βοΈ
Copyright 2022-2025 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.
and that's the whole page, bestie!! π
β¨ this was version 4.0.3, dated 2026-09-29, and it lives at EVP_KEM-EC(7SSL) in the OpenSSL manual. go forth and encapsulate responsibly. slay. ππ¦πΈ
π¦ where this page comes from
- ubuntu stonking: openssl 4.0.3-1ubuntu1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms