tfSslClientUserStart

Jump to: navigation, search

Table of Contents >> SSL Programmer's Reference


#include <trsocket.h>


int tfSslClientUserStart (
int socketDescriptor,
char TM_FAR * serverCommonName
);


Function Description

This function is valid only if TM_USE_SSL_CLIENT is defined. It is called by user in order to start the SSL client and thus the SSL handshaking. Before this call, user should set proper socket options on socket socketDescriptor. See setsockopt() for details.


Parameters

  • socketDescriptor
    socket number you want to start SSL negotiation
  • serverCommonName
    The server's common name. We are going to use this common name to verify the certificate of the peer. If user passes in a NULL string, we don't check the certificate's identity. That means any valid certificate even if it belongs to a bad party the certificate checking procedure will return successfully. We only check the Common Name of Subject field of the certificate for certificate identity verification. We don't check the DNSName in the subjectAltName extension field. The certificate identity (common name field) may contain the wildcard character * which is considered to match any single domain name component or component fragment. E.g., "*.a.com" in certificate Common Name matches serverCommonName "foo.a.com" but not "bar.foo.a.com". And certificate common name "f*.com" matches serverCommonName "foo.com" but not "bar.com"



Returns

  • TM_ENOERROR
    Success
  • TM_ENOBUFS
    No more buffer available
  • TM_EPERM
    Function call not permitted, check if TM_TCP_SSLSESSION and TM_TCP_SSL_CLIENT are both set on this socket
  • TM_EPROTONOTSUPPORT
    The socket is not a TCP socket
  • TM_EBADF
    Socket pointer is not found
  • TM_SOCKET_ERROR
    Error.


Note Note: TM_SOCKET_ERROR means that this socket call has failed and the errorCode has been set on the socket itself.

To retrieve the socket error the user must call tfGetSocketError(socketDescriptor).

Table of Contents >> SSL Programmer's Reference