EVP_KDF-X963(7ossl)
π EVP_KDF-X963 β the X9.63-2001 EVP_KDF glow-up
ok so this is a page from the OpenSSL manual, bestie, and it's about the X963 key derivation function. let's get into it β¨
πΈ NAME πΈ
EVP_KDF-X963 β literally the X9.63-2001 EVP_KDF implementation. that's the whole vibe of this page, no cap π
π¦ DESCRIPTION π¦
so the EVP_KDF-X963 algorithm implements the key derivation function, aka X963KDF (yes it's giving acronym-on-acronym, we love that for us). X963KDF gets used by Cryptographic Message Syntax (CMS) for EC KeyAgreement, to derive a key using input like a shared secret key and shared info π
and the output? considered to be keying material. periodt.
π Identity π
"X963KDF" is the name for this implementation β that's your girl's government name, fr fr. you can use it with the EVP_KDF_fetch() function π«Ά
β Supported parameters β
here's the roster, and yes, every single one is invited to the party:
"properties"(OSSL_KDF_PARAM_PROPERTIES) <UTF8 string>"digest"(OSSL_KDF_PARAM_DIGEST) <UTF8 string>
these two work exactly as described in "PARAMETERS" in EVP_KDF(3). no notes, iconic behavior π
"key"(OSSL_KDF_PARAM_KEY) <octet string> β the shared secret used for key derivation. this parameter sets the secret π"info"(OSSL_KDF_PARAM_INFO) <octet string> β specifies an optional value for shared info. optional! she can show up or she can stay home π
the OpenSSL FIPS provider also supports these next ones π:
"fips-indicator"(OSSL_KDF_PARAM_FIPS_APPROVED_INDICATOR) <integer> β a getter that returns1if the operation is FIPS approved, or0otherwise. you can use this after callingEVP_KDF_derive. it returns0if any"***-check"related parameter is set to0and the check fails π΅οΈ"digest-check"(OSSL_KDF_PARAM_FIPS_DIGEST_CHECK) <int> β the default value of1causes an error duringEVP_KDF_CTX_set_params()if the used digest is not approved. setting this to zero will ignore the error and set the approved"fips-indicator"to0.
β οΈ heads up bestie: this option breaks FIPS compliance if it causes the approved"fips-indicator"to return0. like, actually breaks it. don't play π
according to ANSI X9.63-2001, the approved digest algorithms are: SHA2-224, SHA2-256, SHA2-384, SHA2-512, SHA2-512/224, SHA2-512/256, SHA3-224, SHA3-256, SHA3-384, SHA3-512. the whole approved squad, honorable mentions only π
"key-check"(OSSL_KDF_PARAM_FIPS_KEY_CHECK) <integer> β the default value of1causes an error duringEVP_KDF_CTX_set_params()if the length of the used key-derivation key (OSSL_KDF_PARAM_KEY) is shorter than 112 bits. setting this to zero will ignore the error and set the approved"fips-indicator"to0.
β οΈ same warning, same energy: this option breaks FIPS compliance if it causes the approved"fips-indicator"to return0. lowkey important, highkey important, all the keys π
π NOTES π
X963KDF is very similar to the SSKDF that uses a digest as the auxiliary function β but here's the plot twist: X963KDF appends the counter to the secret, whereas SSKDF prepends the counter. the way that one little ordering difference changes everything π
to get a context for X963KDF, you literally just call:
EVP_KDF *kdf = EVP_KDF_fetch(NULL, "X963KDF", NULL);
EVP_KDF_CTX *kctx = EVP_KDF_CTX_new(kdf);
and the output length of an X963KDF is specified via the keylen parameter to the EVP_KDF_derive(3) function. that's where you tell her how much material you want π
π₯ EXAMPLES π₯
this example derives 10 bytes, with the secret key "secret" and sharedinfo value "label". copy it exactly, don't be cute with it:
EVP_KDF *kdf;
EVP_KDF_CTX *kctx;
unsigned char out[10];
OSSL_PARAM params[4], *p = params;
kdf = EVP_KDF_fetch(NULL, "X963KDF", NULL);
kctx = EVP_KDF_CTX_new(kdf);
EVP_KDF_free(kdf);
*p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_DIGEST,
SN_sha256, strlen(SN_sha256));
*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_SECRET,
"secret", (size_t)6);
*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_INFO,
"label", (size_t)5);
*p = OSSL_PARAM_construct_end();
if (EVP_KDF_derive(kctx, out, sizeof(out), params) <= 0) {
error("EVP_KDF_derive");
}
EVP_KDF_CTX_free(kctx);
π§ CONFORMING TO π§
"SEC 1: Elliptic Curve Cryptography" β she's certified, she's standards-compliant, she's that girl π
π SEE ALSO π
go read these next, bestie, iykyk:
EVP_KDF(3)EVP_KDF_CTX_new(3)EVP_KDF_CTX_free(3)EVP_KDF_CTX_set_params(3)EVP_KDF_CTX_get_kdf_size(3)EVP_KDF_derive(3)"PARAMETERS" in EVP_KDF(3)
π HISTORY π
this functionality was added in OpenSSL 3.0. she's not a legacy icon, she's a modern one β¨
π COPYRIGHT π
Copyright 2019-2024 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 OpenSSL 3.5.9, dated 2026-09-29 β go derive some keys, slay, and remember: append the counter, not prepend. periodt π π
π¦ 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