.\" File automatically generated by doxy2man0.3 .\" Generation date: Thu Sep 3 2026 .TH radcli_ctx_set_tls_psk 3 2026-09-03 "radcli" "Radius client library" .SH "NAME" radcli_ctx_set_tls_psk \- Set the RFC 6614/7360 TLS-transport Pre-Shared Key credentials for the configured authserver. .SH SYNOPSIS .nf .B #include .sp \fBint radcli_ctx_set_tls_psk\fP( \fBradcli_ctx *\fP\fIctx\fP, \fBconst void *\fP\fIidentity\fP, \fBsize_t \fP\fIidentity_len\fP, \fBconst uint8_t *\fP\fIkey\fP, \fBsize_t \fP\fIkeylen\fP ); .fi .SH DESCRIPTION .PP The equivalent, for the new API, of the legacy authserver host:port:psk@username@hexkey inline form but with identity and key as independent byte buffers instead of a delimited string, so a username containing @ cannot be misparsed (the legacy form splits on the first @ after the psk@ prefix) and the key never needs to be hex-encoded by the caller. Only meaningful when #RADCLI_OPT_SERV_TYPE is tls or dtls; takes priority over any psk@username@hexkey embedded in #RADCLI_OPT_AUTHSERVER's value, should both somehow be set. .SH PARAMETERS .TP .B ctx a context, before radcli_ctx_apply(). .TP .B identity the PSK identity; GnuTLS treats this as a NUL-terminated string once passed on, so an identity containing an embedded NUL byte is truncated there a GnuTLS API constraint, not an ambiguity this function introduces. .TP .B identity_len identity's length in bytes. .TP .B key the raw PSK key bytes (not hex-encoded text). .TP .B keylen key's length in bytes. .SH RETURN VALUE .PP 0 on success, -1 on failure (NULL ctx/identity/key, or keylen 0). .SH SEE ALSO .PP .nh .ad l \fIradcli_ctx_apply\fP(3), \fIradcli_ctx_free\fP(3), \fIradcli_ctx_get_opt_int\fP(3), \fIradcli_ctx_get_opt_str\fP(3), \fIradcli_ctx_new\fP(3), \fIradcli_ctx_read_config\fP(3), \fIradcli_ctx_read_dictionary\fP(3), \fIradcli_ctx_read_dictionary_from_buffer\fP(3), \fIradcli_ctx_set_opt_int\fP(3), \fIradcli_ctx_set_opt_str\fP(3), \fIradcli_ctx_set_secret\fP(3) .ad .hy