radcli_ctx_set_tls_psk(3)

πŸ“¦ version 2.0.1, in arch rolling

πŸ’… radcli_ctx_set_tls_psk(3)

okay so this page lives in the Radius client library manpage collection (that's the manual name, bestie, consider it folded in 🫢) and it's about one very specific little function. Buckle up.


✨ NAME ✨

radcli_ctx_set_tls_psk β€” sets the RFC 6614/7360 TLS-transport Pre-Shared Key credentials for the authserver you've already configured. that's it, that's the whole vibe πŸ”‘


🌸 SYNOPSIS 🌸

#include <radcli/>

int radcli_ctx_set_tls_psk(
    radcli_ctx     *ctx,
    const void     *identity,
    size_t          identity_len,
    const uint8_t  *key,
    size_t          keylen
);

πŸ¦‹ DESCRIPTION πŸ¦‹

So this is the new-API glow-up of the legacy inline form host:port:psk@username@hexkey β€” same energy, way better execution. the difference? here identity and key are independent byte buffers instead of one delimited string. iconic. why does that matter, you ask? because:

  • a username that literally contains @ cannot be misparsed β€” the legacy form splits on the first @ after the psk@ prefix, which is lowkey cursed πŸ’€
  • the key never needs to be hex-encoded by the caller. raw bytes, bestie. we love to see it ✨

it's only meaningful when #RADCLI_OPT_SERV_TYPE is tls or dtls. and just so we're clear: this takes priority over any psk@username@hexkey embedded in the value of #RADCLI_OPT_AUTHSERVER, should both somehow end up set. (like, don't do that, but if you did β€” this one wins πŸ‘‘)


πŸŽ€ PARAMETERS πŸŽ€

  • ctx β€” a context. gotta be before radcli_ctx_apply(), bestie. no exceptions 🌈
  • identity β€” the PSK identity. heads up though: GnuTLS treats this as a NUL-terminated string once it's been passed along, so an identity with an embedded NUL byte gets truncated there. that's a GnuTLS API constraint, not some ambiguity this function made up β€” fr fr, not us πŸ™ˆ
  • identity_len β€” identity's length, in bytes.
  • key β€” the raw PSK key bytes. not hex-encoded text, okay? raw. πŸ’œ
  • keylen β€” key's length, in bytes.

⭐ RETURN VALUE ⭐

  • 0 on success πŸŽ‰
  • -1 on failure β€” that's a NULL ctx, NULL identity, NULL key, or a keylen of 0. those are the four moods, and none of them are cute 😭

πŸ”₯ SEE ALSO πŸ”₯

radcli_ctx_apply(3), radcli_ctx_free(3), radcli_ctx_get_opt_int(3), radcli_ctx_get_opt_str(3), radcli_ctx_new(3), radcli_ctx_read_config(3), radcli_ctx_read_dictionary(3), radcli_ctx_read_dictionary_from_buffer(3), radcli_ctx_set_opt_int(3), radcli_ctx_set_opt_str(3), radcli_ctx_set_secret(3) β€” read them all, it's giving "well-rounded Unix scholar" πŸ“šπŸŒΈ


and that's the whole page, bestie. brought to you by radcli, dated 2026-10-10 β€” go set some PSKs, slay πŸ’…βœ¨

πŸ“¦ where this page comes from