EVP_KDF-SRTPKDF(7SSL)

πŸ“¦
version 4.0.3 Β· 2 versions
, in ubuntu stonking

✨ 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 be 16 bytes for AES-128, 24 bytes for AES-192 or 32 bytes 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 least 14 bytes. 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 range 2^0 to 2^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 least 6 bytes for RTP packets, or at least 4 bytes 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 key
    • 1 β€” SRTP authentication key
    • 2 β€” SRTP salt key
    • 3 β€” SRTCP encryption key
    • 4 β€” SRTCP authentication key
    • 5 β€” SRTCP salt key
    • 6 β€” SRTP encryption key (alternative)
    • 7 β€” SRTP salt key (alternative)
  • "fips-indicator" (OSSL_KDF_PARAM_FIPS_APPROVED_INDICATOR) <integer> β€” the OpenSSL FIPS provider returns 1 if the operation is FIPS approved, or 0 otherwise. see "FIPS indicators" in fips_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 is 20 bytes (160 bits)
  • Labels 2, 5, 7: output length is 14 bytes (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 🌸

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 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