radcli_ctx_set_tls_psk(3)
π 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 thepsk@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 beforeradcli_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 β
0on success π-1on failure β that's aNULLctx,NULLidentity,NULLkey, or akeylenof0. 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
- arch rolling: radcli 2.0.1-1 Β· BSD
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms