gnutls_prf_rfc5705(3)

✨ gnutls_prf_rfc5705 β€” the glow-up edition ✨

okay so bestie, welcome to the gnutls_prf_rfc5705(3) page πŸ’– this one lives in the gnutls manual, and it's literally the function you call when you want to ~export keying material~ out of a TLS/DTLS session and hand it to your app. no cap. let's get into it 🫢


🌸 NAME 🌸

gnutls_prf_rfc5705 β€” API function. that's the whole vibe. it's giving "cryptographic key exporter, but make it RFC-compliant" πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

#include <gnutls/gnutls.h>

int gnutls_prf_rfc5705(gnutls_session_t session, size_t label_size,
const char * label, size_t context_size, const char * context, size_t
outsize, char * out);

yes queen, that's the whole signature, verbatim, don't @ me ✨


πŸ¦‹ ARGUMENTS πŸ¦‹

  • gnutls_session_t session β€” this is a gnutls_session_t type. that's it, that's the argument. your actual live session, the main character πŸ‘‘
  • size_t label_size β€” the length of the label variable. how many bytes of label are we working with, bestie πŸ“
  • const char * label β€” the label used in the PRF computation. typically a short string, like a lil nickname for what this data is for 🏷️
  • size_t context_size β€” the length of the extra variable. context's byte count, fr fr
  • const char * context β€” optional extra data to seed the PRF with. optional, but iconic when present 🌈
  • size_t outsize β€” size of the pre-allocated output buffer that's gonna hold the output. you gotta tell it how much room there is πŸ«™
  • char * out β€” the pre-allocated buffer itself that holds the generated data. this is where the magic lands ✨

πŸ’œ DESCRIPTION πŸ’œ

So basically: this function exports keying material from a TLS/DTLS session to an application, exactly as specified in RFC5705. periodt.

In TLS versions prior to 1.3, it applies the TLS Pseudo-Random-Function (PRF) on the master secret and the provided data, seeded with the client and server random fields. classic behavior, lowkey nostalgic 😌

In TLS 1.3, it applies HKDF on the exporter master secret derived from the master secret. new era, new algorithm, still slaying πŸ”₯

The label variable usually contains a string denoting the purpose for the generated data β€” like a lil name tag for your bytes 🏷️

The context variable can be used to add more data to the seed, after the random variables. It can be used to make sure the generated output is strongly connected to some additional data (e.g., a string used in user authentication). so like, bind that output to your auth flow, iykyk πŸ”

The output is placed in out, which must be pre-allocated. gnutls is not doing that for you, bestie, you gotta bring your own buffer 🫢

⚠️ Note that, to provide the RFC5705 context, the context variable must be non-null. don't be out here passing null and expecting context magic, it's not happening πŸ’€

🌟 RETURNS 🌟

GNUTLS_E_SUCCESS on success, or an error code. that's the whole deal β€” check your return value, always, no exceptions πŸ™ˆ


⭐ SINCE ⭐

3.4.4 β€” it's been here since 3.4.4, a whole legend πŸ’…


πŸ› REPORTING BUGS πŸ›

Found a bug? Don't suffer in silence, tell the gnutls girlies:


Copyright Β© 2001-2023 Free Software Foundation, Inc., and others.

Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved.

(that's the license, and it's genuinely generous of them, we love to see it 🫢)


🌈 SEE ALSO 🌈

The full documentation for gnutls is maintained as a Texinfo manual. If the /usr/share/doc/gnutls/ directory does not contain the HTML form, visit:

https://www.gnutls.org/manual/


and that's the page, bestie πŸ’– this was gnutls version 3.8.13, dropping the gnutls_prf_rfc5705(3) knowledge straight into your terminal. go forth and export your keying material responsibly βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from