tfSslPskRegisterCallback

Jump to: navigation, search

Table of Contents >> SSL Programmer's Reference


#include <trsocket.h>


int tfSslPskRegisterCallback (
int sessionId,
ttUserSslPskCBFuncPtr funcPtr
);


Function Description

You must call this function for each TLS/SSL session that uses a Pre-Shared Key (PSK) to connect. The function you supply will receive a pointer to a structure for passing data to and from your function. If both TLS parties choose PSK, your function will be called during the initial TLS handshake for additional information. The information transferred depends on whether your application is a client or server.

The PSK client application must supply the PSK key (password) and PSK identity. The PSK server application must supply the key for the PSK identity it receives from the client. The PSK client application may receive a PSK hint from the server. The client may ignore the hint or use it to select the PSK key.

Be wary of the context in which your function is called and avoid unnecessary delays, like file I/O. Your function must return zero to continue the TLS handshake. A non-zero return will result in a handshake failure.


Parameters

  • sessionId
    The TLS/SSL session identifier returned by tfSslNewSession(). Every TLS/SSL connection spawned from this session will be capable of negotiating PSK ciphersuites with the peer.
  • funcPtr
    A pointer to a callback function with prototype ttUserSslPskCBFuncPtr. Your function will only be called if both peers agree to use a PSK ciphersuite.


Returns

  • TM_ENOERROR
    Callback function is successfully registered.
  • TM_EINVAL
    Invalid session.


Table of Contents >> SSL Programmer's Reference