29 #ifndef ONLY_LOCAL_PROXY
38 m_pCtx = SSL_CTX_new( TLSv1_client_method() );
39 #ifdef SSL_OP_NO_TICKET
41 SSL_CTX_set_options(
m_pCtx, SSL_OP_ALL|SSL_OP_NO_TICKET);
43 SSL_CTX_set_options(
m_pCtx, SSL_OP_ALL);
110 if((status = SSL_connect(
m_pSSL )) != 1)
112 int err = SSL_get_error(
m_pSSL, status);
113 CAMsg::printMsg(LOG_INFO,
"CATLSClientSocket::doTLSConnect() failed! Reason: %i\n", err);
130 if(ret != X509_V_OK&&ret!=X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT )
132 CAMsg::printMsg(LOG_ERR,
"SSLClientSocket: the Server certificate is INVALID!! Error: %i\n",ret);
137 X509* peerCert=SSL_get_peer_certificate(
m_pSSL);
140 CAMsg::printMsg(LOG_ERR,
"SSLClientSocket: the Server shows no certificate!\n");
149 ret=X509_verify(peerCert,pubKey);
154 CAMsg::printMsg(LOG_ERR,
"SSLClientSocket: could not verify server certificate!\n");
199 int err = SSL_get_error(
m_pSSL, ret);
200 if ( (SSL_ERROR_WANT_READ == err) ||
201 (SSL_ERROR_WANT_WRITE == err) )
206 if( (err == SSL_ERROR_SYSCALL) && (ret == -1) )
209 CAMsg::printMsg(LOG_ERR,
"TLS-Socket: send I/O error occured: %s\n", strerror(errnum));
249 int err = SSL_get_error(
m_pSSL, ret);
250 if ( (SSL_ERROR_WANT_READ == err) ||
251 (SSL_ERROR_WANT_WRITE == err) )
256 if( (err == SSL_ERROR_SYSCALL) && (ret == -1) )
259 CAMsg::printMsg(LOG_ERR,
"TLS-Socket: receive I/O error occured: %s\n", strerror(errnum));
CACertificate * clone() const
static SINT32 printMsg(UINT32 typ, const char *format,...)
Writes a given message to the log.
This is an abstract class for representing a socket address used in CASocket, CADatagramSocket and CA...
virtual SINT32 connect(const CASocketAddr &psa)
SINT32 send(const UINT8 *buff, UINT32 len)
Sends all data over the network.
SINT32 close()
Shuts down the socket.
SINT32 receive(UINT8 *buff, UINT32 len)
Will receive some bytes from the socket.
SINT32 connect(const CASocketAddr &psa, UINT32 msTimeout)
Establishes the actual TCP/IP connection and performs the TLS handshake.
SINT32 sendFully(const UINT8 *buff, UINT32 len)
Sends all data over the network.
SINT32 setServerCertificate(CACertificate *pCert)
Sets the Certifcate we accept as server identification.
CACertificate * m_pRootCert
bool m_bConnectedTLS
is the TLS layer established ?
SINT32 doTLSConnect(const CASocketAddr &psa)
Does the TLS handshake.