TLS 1.3 supports session resumption using pre-shared keys. After a successful handshake the server may send the client a NewSessionTicket record, that contains a pre-shared key. The client may use this pre-shared key in order to resume the session in the future.
On the client side, I need to read the NewSessionTicket so I can later use the PSK to resume the session. The client should be able to run once and conduct a full handshake. Later, the client should be able to run again and conduct a psk session resumption.
I am having trouble reading the NewSessionTicket sent by the server using OpenSSL. I tried to use SSL_Read but it just returned an empty buffer. I also tried to use SSL_SESSION_get0_ticket_appdata but it didn't work too. Lastly, I tried to use SSL_get_psk_identity, but again it just returned a null pointer.
What is the proper way to read the NewSessionTicket?