EVP_KEM-EC(7ossl)
π EVP_KEM-EC(7ossl) β like, the EC keytype's KEM era π
okay bestie, so this is a 7ossl manpage and it's about EVP_KEM-EC β the EVP_KEM support for the EC keytype and its algorithm. no cap, it's shorter than you'd think, so let's get into it π
β¨ NAME β¨
EVP_KEM-EC β EVP_KEM EC keytype and algorithm support. that's the whole name, she's lowkey modest π
πΈ DESCRIPTION πΈ
so the EC keytype and all its params are described over in EVP_PKEY-EC(7) β go read that if you want the full lore. and if you want the actual mechanics of encapsulating and decapsulating, that's EVP_PKEY_encapsulate(3) and EVP_PKEY_decapsulate(3). iykyk π¦
π EC KEM parameters π
here's where the actual tea is. there are two params, and they're giving main character energy:
"operation"(OSSL_KEM_PARAM_OPERATION)<UTF8 string>β this one sets the operating mode. and the OpenSSL EC Key Encapsulation Mechanisms only support the following default operation, periodt:"DHKEM"(OSSL_KEM_PARAM_OPERATION_DHKEM) β okay so here's what happens π: the encapsulate function generates an ephemeral keypair. it 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 are returned. meanwhile the decapsulate function uses 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. literally the same secret, both sides. slay. π see <https://www.rfc-editor.org/rfc/rfc9180.html#name-dh-based-kem-dhkem>
you can set this using either EVP_PKEY_CTX_set_kem_op() or EVP_PKEY_CTX_set_params(). either one, your call β¨
"ikme"(OSSL_KEM_PARAM_IKME)<octet string>β this one specifies the key material used for generation of the ephemeral key. β οΈ this value should not be reused for other purposes β fr fr, don't do it. 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's32,48and66for the listed curves respectively. if this value is not set, then a random ikm is used. easy π
π§ CONFORMING TO π§
RFC9180 β that's the one, bestie π
π¦ 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)
go click around, it's giving rabbit hole π
β HISTORY β
this functionality was added in OpenSSL 3.2 π
and here's a lil glow-up note: the "operation" (operating mode) was a required parameter prior to OpenSSL 3.5. as of OpenSSL 3.5, "DHKEM" is the default operating mode, and no explicit value need be specified. so if you were out here typing it every single time... not anymore, bestie ππ
π 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>.
okay that's the whole page!! no filler, all facts, we ate fr π«Ά
and a lil sign-off for the road: this lil beauty is from the 3.5.9 source, dated 2026-09-29, and it lives under the manual name EVP_KEM-EC(7ossl). mwah ππΈ
π¦ where this page comes from
- alpine 3.23: openssl-doc 3.5.9-r0 Β· Apache-2.0
- alpine 3.24: openssl-doc 3.5.9-r0 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms