[#OSSL_HPKE_CTX_set1_psk]
= OSSL&lowbar;HPKE&lowbar;CTX&lowbar;set1&lowbar;psk
:mrdocs:

Set the pre&hyphen;shared key and PSK identifier for PSK &sol; PSKAUTH modes&period;

== Synopsis

Declared in `&lt;openssl&sol;hpke&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
int
OSSL&lowbar;HPKE&lowbar;CTX&lowbar;set1&lowbar;psk(
    xref:OSSL_HPKE_CTX.adoc[OSSL&lowbar;HPKE&lowbar;CTX]* ctx,
    char const* pskid,
    unsigned char const* psk,
    size&lowbar;t psklen);
----

== Return Value

1 on success, or 0 on error&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *ctx*
| HPKE context on sender or receiver (call before encap&sol;decap)&period;
| *pskid*
| NUL&hyphen;terminated PSK identity string (non&hyphen;NULL when a PSK is used)&period;
| *psk*
| PSK bytes (non&hyphen;NULL&semi; length at least OSSL&lowbar;HPKE&lowbar;MIN&lowbar;PSKLEN)&period;
| *psklen*
| Length of `psk` in bytes&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
