radcli_ctx_set_tls_psk(3)

radcli_ctx_set_tls_psk3

Set the rfc 6614/7360 tls-transport pre-shared key credentials for the configured authserver.

Usage

#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
);

Overview

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.

Parameters

ctx

a context, before radcli_ctx_apply().

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.

identity_len

identity's length in bytes.

key

the raw PSK key bytes (not hex-encoded text).

keylen

key's length in bytes.

Return value

0 on success, -1 on failure (NULL ctx/identity/key, or keylen 0).

From radcli 2.0.1-1 in Arch Linux 2026-11-01. Parsed by carta from the page's man source.