EVP_KDF-SRTPKDF(7SSL)
β¨ EVP_KDF-SRTPKDF β¨
okay bestie, gather round, because this is the page for the SRTP EVP_KDF implementation in OpenSSL (that's the 7SSL manual, iykyk). it's giving secure-real-time-protocol key derivation and honestly? kinda iconic. let's get into it π
πΈ NAME πΈ
EVP_KDF-SRTPKDF β the SRTP EVP_KDF implementation. that's the whole vibe. no cap.
π¦ DESCRIPTION π¦
so basically we have support for computing the SRTP KDF through the EVP_KDF API. slay.
the EVP_KDF-SRTP algorithm implements the SRTP key derivation function. SRTP follows the spec in RFC 3711 Section 4.3.3, where all kinds of cryptographic keys (encryption, authentication, and salt keys) get derived from a master key and a master salt using AES encryption with specific labels. it's a whole thing and it works.
those output keys? they're used for SRTP and SRTCP packet protection. periodt. π₯
π Identity π
"SRTP" is the name for this implementation. literally just use it with the EVP_KDF_fetch() function and you're good. π«Ά
π Supported parameters π
here's the lineup, bestie β every param, every vibe:
"properties"(OSSL_KDF_PARAM_PROPERTIES) <UTF8 string> β this one is just chillin' here as a supported parameter. (yes queen, no further description, that's what the page says π)"cipher"(OSSL_KDF_PARAM_CIPHER) <UTF8 string> β sets the cipher to be used for the key derivation. it must be set to one of"AES-128-CTR","AES-192-CTR"or"AES-256-CTR". pick one, no improvising."key"(OSSL_KDF_PARAM_KEY) <octet string> β sets the master key value. must be16bytes for AES-128,24bytes for AES-192 or32bytes for AES-256. don't get the sizes wrong bestie, I'm begging π"salt"(OSSL_KDF_PARAM_SALT) <octet string> β sets the master salt value. must be at least14bytes. and heads up: larger salts are truncated. no cap."kdr"(OSSL_KDF_PARAM_SRTPKDF_KDR) <unsigned integer> β sets the key derivation rate (KDR). the KDR controls how often keys are rederived. if it's not set or it's set to zero, no key rederivation is performed. the KDR value is a power of 2 in the range2^0to2^24. math girlies rise π"index"(OSSL_KDF_PARAM_SRTPKDF_INDEX) <octet string> β sets the index value used in key derivation. the length must be at least6bytes for RTP packets, or at least4bytes for RTCP packets. also: larger index values are truncated. if it's not set, or it has zero length, no key rederivation is performed."label"(OSSL_KDF_PARAM_SRTPKDF_LABEL) <unsigned integer> β sets the label that identifies the type of key to derive. valid values are:0β SRTP encryption key1β SRTP authentication key2β SRTP salt key3β SRTCP encryption key4β SRTCP authentication key5β SRTCP salt key6β SRTP encryption key (alternative)7β SRTP salt key (alternative)
"fips-indicator"(OSSL_KDF_PARAM_FIPS_APPROVED_INDICATOR) <integer> β the OpenSSL FIPS provider returns1if the operation is FIPS approved, or0otherwise. see"FIPS indicators"infips_module(7)for more info. keeping it compliant, we love to see it β
π NOTES π
wanna get yourself a context for SRTP? call this, bestie:
EVP_KDF *kdf = EVP_KDF_fetch(NULL, "SRTP", NULL);
EVP_KDF_CTX *kctx = EVP_KDF_CTX_new(kdf);
and here's the tea β β the output length of the SRTP KDF derive operation is determined by the label:
- Labels
0,3,6: output length equals the cipher key length - Labels
1,4: output length is20bytes (160 bits) - Labels
2,5,7: output length is14bytes (112 bits)
the way the label just decides everything? main character energy fr fr π
π EXAMPLES π
example one: deriving an SRTP encryption key π
this one derives an SRTP encryption key (label 0) using AES-128-CTR with a 16-byte master key and 14-byte master salt:
EVP_KDF *kdf;
EVP_KDF_CTX *kctx;
unsigned char out[16];
unsigned char master_key[16] = { /* master key bytes */ };
unsigned char master_salt[14] = { /* master salt bytes */ };
uint32_t label = 0;
OSSL_PARAM params[5], *p = params;
kdf = EVP_KDF_fetch(NULL, "SRTP", NULL);
kctx = EVP_KDF_CTX_new(kdf);
EVP_KDF_free(kdf);
*p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_CIPHER,
"AES-128-CTR", 0);
*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_KEY,
master_key, sizeof(master_key));
*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_SALT,
master_salt, sizeof(master_salt));
*p++ = OSSL_PARAM_construct_uint32(OSSL_KDF_PARAM_SRTPKDF_LABEL, &label);
*p = OSSL_PARAM_construct_end();
if (EVP_KDF_derive(kctx, out, sizeof(out), params) <= 0) {
error("EVP_KDF_derive");
}
EVP_KDF_CTX_free(kctx);
example two: deriving an SRTP authentication key β¨
this one derives an SRTP authentication key (label 1) with a key derivation rate and an index:
EVP_KDF *kdf;
EVP_KDF_CTX *kctx;
unsigned char out[20];
unsigned char master_key[16] = { /* master key bytes */ };
unsigned char master_salt[14] = { /* master salt bytes */ };
uint32_t kdr = 0x1000; /* KDR */
unsigned char index[6] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }; /* index */
uint32_t label = 1;
OSSL_PARAM params[7], *p = params;
kdf = EVP_KDF_fetch(NULL, "SRTP", NULL);
kctx = EVP_KDF_CTX_new(kdf);
EVP_KDF_free(kdf);
*p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_CIPHER,
"AES-128-CTR", 0);
*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_KEY,
master_key, sizeof(master_key));
*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_SALT,
master_salt, sizeof(master_salt));
*p++ = OSSL_PARAM_construct_uint32(OSSL_KDF_PARAM_SRTPKDF_KDR, &kdr);
*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_SRTPKDF_INDEX,
index, sizeof(index));
*p++ = OSSL_PARAM_construct_uint32(OSSL_KDF_PARAM_SRTPKDF_LABEL, &label);
*p = OSSL_PARAM_construct_end();
if (EVP_KDF_derive(kctx, out, sizeof(out), params) <= 0) {
error("EVP_KDF_derive");
}
EVP_KDF_CTX_free(kctx);
copy, paste, thrive. you got this π«Ά
π CONFORMING TO π
RFC 3711 Section 4.3.3 (SRTP Key Derivation). we follow the rules, always π
πΈ SEE ALSO πΈ
EVP_KDF(3)EVP_KDF_CTX_new(3)EVP_KDF_CTX_free(3)EVP_KDF_CTX_set_params(3)EVP_KDF_derive(3)"PARAMETERS" in EVP_KDF(3)
go read them too, bestie, they're all connected ππ
β HISTORY β
the SRTPKDF was added in OpenSSL 4.0.0. so it's new, it's fresh, it's giving debut era π
π COPYRIGHT π
Copyright 2026 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 page, babes π this was OpenSSL 4.0.3, dated 2026-09-29, all wrapped up with a bow π stay encrypted, stay iconic, and don't forget to free your contexts. mwah π
π¦ 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