|
Mixes for Privacy and Anonymity in the Internet
|
Public Member Functions | |
| CATLSClientSocket () | |
| ~CATLSClientSocket () | |
| SINT32 | sendFully (const UINT8 *buff, UINT32 len) |
| Sends all data over the network. | |
| SINT32 | send (const UINT8 *buff, UINT32 len) |
| Sends all data over the network. | |
| SINT32 | receive (UINT8 *buff, UINT32 len) |
| Will receive some bytes from the socket. | |
| SINT32 | close () |
| Shuts down the socket. | |
| SINT32 | connect (CASocketAddr &psa, UINT32 msTimeout) |
| Establishes the actual TCP/IP connection and performs the TLS handshake. | |
| SINT32 | setServerCertificate (CACertificate *pCert) |
| Sets the Certifcate we accept as server identification. | |
Private Member Functions | |
| SINT32 | doTLSConnect (CASocketAddr &psa) |
| Does the TLS handshake. | |
Private Attributes | |
| SSL * | m_pSSL |
| SSL_CTX * | m_pCtx |
| CACertificate * | m_pRootCert |
| bool | m_bConnectedTLS |
| is the TLS layer established ? | |
References m_bConnectedTLS, m_pCtx, m_pRootCert, and m_pSSL.
References close(), m_pCtx, and m_pRootCert.
| SINT32 CATLSClientSocket::close | ( | ) | [virtual] |
Shuts down the socket.
This is an overridden virtual function which shuts down the TLS layer first
Reimplemented from CASocket.
References m_bConnectedTLS, and m_pSSL.
Referenced by connect(), doTLSConnect(), CAAccountingBIInterface::initBIConnection(), CAAccountingBIInterface::terminateBIConnection(), and ~CATLSClientSocket().
| SINT32 CATLSClientSocket::connect | ( | CASocketAddr & | psa, |
| UINT32 | msTimeout | ||
| ) |
Establishes the actual TCP/IP connection and performs the TLS handshake.
Establishes the TCP/IP connection, performs the TLS handshake and checks the server certificate validity.
References close(), CASocket::connect(), doTLSConnect(), and E_SUCCESS.
Referenced by CAAccountingBIInterface::initBIConnection().
| SINT32 CATLSClientSocket::doTLSConnect | ( | CASocketAddr & | psa | ) | [private] |
Does the TLS handshake.
The TCP Connection must be established first and openSSL library must be initialized
References close(), E_SUCCESS, E_UNKNOWN, CACertificate::getX509(), m_bConnectedTLS, m_pCtx, m_pRootCert, m_pSSL, CASocket::m_Socket, and CAMsg::printMsg().
Referenced by connect().
| SINT32 CATLSClientSocket::receive | ( | UINT8 * | buff, |
| UINT32 | len | ||
| ) | [virtual] |
Will receive some bytes from the socket.
May block or not depending on whatever this socket was set to blocking or non-blocking mode. Warning: If socket is in blocking mode and receive is called, receive will block until some data is available, EVEN IF AN OTHER THREAD WILL CLOSE THIS SOCKET!
| buff | the buffer which get the received data |
| len | size of buff |
| E_AGAIN,if | socket was in non-blocking mode and receive would block or a timeout was reached |
| 0 | if socket was gracefully closed |
Reimplemented from CASocket.
References E_AGAIN, m_pSSL, CAMsg::printMsg(), SOCKET_ERROR, and strerror().
| SINT32 CATLSClientSocket::send | ( | const UINT8 * | buff, |
| UINT32 | len | ||
| ) | [virtual] |
Sends all data over the network.
This may block, until all data was sent.
| buff | the buffer of data to send |
| len | content length |
| E_UNKNOWN | if an error occured |
| E_SUCCESS | if successfull |
Reimplemented from CASocket.
References E_AGAIN, E_SUCCESS, m_pSSL, CAMsg::printMsg(), SOCKET_ERROR, and strerror().
| SINT32 CATLSClientSocket::sendFully | ( | const UINT8 * | buff, |
| UINT32 | len | ||
| ) | [virtual] |
Sets the Certifcate we accept as server identification.
Init the SSL object.
Set to NULL if you do not want any certificate checking. At the moment only a depth of verification path of zero or one is supported!
SSL_init_library() must be called before this!
References CACertificate::clone(), E_SUCCESS, and m_pRootCert.
Referenced by CAAccountingBIInterface::initBIConnection().
bool CATLSClientSocket::m_bConnectedTLS [private] |
is the TLS layer established ?
Referenced by CATLSClientSocket(), close(), and doTLSConnect().
SSL_CTX* CATLSClientSocket::m_pCtx [private] |
Referenced by CATLSClientSocket(), doTLSConnect(), and ~CATLSClientSocket().
CACertificate* CATLSClientSocket::m_pRootCert [private] |
Referenced by CATLSClientSocket(), doTLSConnect(), setServerCertificate(), and ~CATLSClientSocket().
SSL* CATLSClientSocket::m_pSSL [private] |
Referenced by CATLSClientSocket(), close(), doTLSConnect(), receive(), send(), and sendFully().
1.7.6.1