1SSL_CTX_use_psk_identity_hint(3) OpenSSL SSL_CTX_use_psk_identity_hint(3)
2
3
4
6 SSL_CTX_use_psk_identity_hint, SSL_use_psk_identity_hint,
7 SSL_CTX_set_psk_server_callback, SSL_set_psk_server_callback - set PSK
8 identity hint to use
9
11 #include <openssl/ssl.h>
12
13 int SSL_CTX_use_psk_identity_hint(SSL_CTX *ctx, const char *hint);
14 int SSL_use_psk_identity_hint(SSL *ssl, const char *hint);
15
16 void SSL_CTX_set_psk_server_callback(SSL_CTX *ctx,
17 unsigned int (*callback)(SSL *ssl, const char *identity,
18 unsigned char *psk, int max_psk_len));
19 void SSL_set_psk_server_callback(SSL *ssl,
20 unsigned int (*callback)(SSL *ssl, const char *identity,
21 unsigned char *psk, int max_psk_len));
22
24 SSL_CTX_use_psk_identity_hint() sets the given NULL-terminated PSK
25 identity hint hint to SSL context object ctx.
26 SSL_use_psk_identity_hint() sets the given NULL-terminated PSK identity
27 hint hint to SSL connection object ssl. If hint is NULL the current
28 hint from ctx or ssl is deleted.
29
30 In the case where PSK identity hint is NULL, the server does not send
31 the ServerKeyExchange message to the client.
32
33 A server application must provide a callback function which is called
34 when the server receives the ClientKeyExchange message from the client.
35 The purpose of the callback function is to validate the received PSK
36 identity and to fetch the pre-shared key used during the connection
37 setup phase. The callback is set using functions
38 SSL_CTX_set_psk_server_callback() or SSL_set_psk_server_callback(). The
39 callback function is given the connection in parameter ssl,
40 NULL-terminated PSK identity sent by the client in parameter identity,
41 and a buffer psk of length max_psk_len bytes where the pre-shared key
42 is to be stored.
43
45 SSL_CTX_use_psk_identity_hint() and SSL_use_psk_identity_hint() return
46 1 on success, 0 otherwise.
47
48 Return values from the server callback are interpreted as follows:
49
50 0 PSK identity was not found. An "unknown_psk_identity" alert message
51 will be sent and the connection setup fails.
52
53 >0 PSK identity was found and the server callback has provided the PSK
54 successfully in parameter psk. Return value is the length of psk in
55 bytes. It is an error to return a value greater than max_psk_len.
56
57 If the PSK identity was not found but the callback instructs the
58 protocol to continue anyway, the callback must provide some random
59 data to psk and return the length of the random data, so the
60 connection will fail with decryption_error before it will be
61 finished completely.
62
63
64
651.0.2o 2020-01-28 SSL_CTX_use_psk_identity_hint(3)