class tcpsocket::SSLSocket
Implements a Secure Sockets Layer socket connection
Child Classes
Implements a Secure Sockets Layer socket connection
- Direct child classes:
- SSLServerSocket
Inheritance:
Public Methods
-
SSLSocket(const char* host, short port, SSLContext* pCtx) throw(SSLSocketException, SocketException)
-
Constructs the socket and opens a connection to a server
-
SSLSocket()
-
Constructs the SSLSocket object, usable for copy destinations
-
SSLSocket(int socket_handle, SSLContext* pCtx, con_type type)
-
Constructs the SSLSocket and uses the provided socket handle for communications
-
SSLSocket(const SSLSocket& s)
-
Copy constructor, copies the socket handle
-
Socket* clone() const
-
Clones this object
-
void close() throw(SocketException)
-
Closes the socket handle, and frees the SSL structures
-
SSLContext* getCTX()
-
Gets the SSLContext Object associated with the socket
-
std::string getErrorMessage()
-
Gets the SSL error message
-
X509Certificate* getPeerCertificate()
-
Retreives the certificate of the peer
Note: The returned object must be freed by the caller
-
void* getSSL()
-
Gets the SSL object cast as void
-
int getVerifyResult()
-
Gets the result of performing a certificate verification
-
SSLSocket& operator=(const SSLSocket& s)
-
Copy oeprator, copies the socket handle and SSL information
-
size_t receive(char* readBuffer, size_t length) throw(SSLSocketException)
-
Receives data from the socket.
-
size_t receiveSome(char* readBuffer, size_t length) throw(SSLSocketException)
-
Receives data from the socket.
-
size_t send(const char* sendBuffer, size_t length) throw(SSLSocketException)
-
Sends data over the socket.
-
~SSLSocket()
-
Destroys the SSL socket
Public Members
enum con_type
An enumeration SSL Conneciton types indicating whether the object will be used as a client or server
Inherited from Socket:
Public Methods
-
virtual int getSocket()
-
bool getThrowOnClosed()
-
void setThrowOnClosed(bool throwOnClose)
Protected Fields
int m_socket
Member Documentation
enum con_type - An enumeration SSL Conneciton types indicating whether the object will be used as a client or server
con_client - A client connection
con_server - A server connection
SSLSocket ()-
Constructs the SSLSocket object, usable for copy destinations
SSLSocket (int socket_handle, SSLContext* pCtx, con_type type)-
Constructs the SSLSocket and uses the provided socket handle for communications
- Parameters:
- socket_handle - [in] A previously created socket handle
pCtx - [in] A previously created SSLContext
type - [in, default = con_client] Indicates wether the socket is a client or server
SSLSocket (const SSLSocket& s)-
Copy constructor, copies the socket handle
- Parameters:
- s - [in] The source socket
SSLSocket (const char* host, short port, SSLContext* pCtx) throw(SSLSocketException, SocketException)-
Constructs the socket and opens a connection to a server
- Parameters:
- host - [in] The address of the server or DNS name
- port [in] The TCP port to connect to
version - [in] The SSL Protocol version to use
~SSLSocket ()-
Destroys the SSL socket
SSLSocket& operator= (const SSLSocket& s)-
Copy oeprator, copies the socket handle and SSL information
- Parameters:
- s - [in] The source socket
- Returns:
- A reference tot his object.
size_t send (const char* sendBuffer, size_t length) throw(SSLSocketException)-
Sends data over the socket. Sends exactly
length
bytes.
- Throws:
- SocketException if the connection was closed and the throw on close flag was set.
- Parameters:
- sendBuffer - [in] A buffer containing the data to be sent
length - [in] The number of bytes in the buffer
- Returns:
- The number of bytes sent, -1 on error, and 0 if the connection was closed
size_t receive (char* readBuffer, size_t length) throw(SSLSocketException)-
Receives data from the socket. Receives exactly
length
bytes or
less if the socket is closed early.
- Throws:
- SocketException if the connection was closed and the throw on close flag was set.
- Parameters:
- sendBuffer - [out] A buffer receiving the data
length - [in] The maximum number of bytes in the buffer
- Returns:
- The number of bytes received, -1 on error, and 0 if the connection was closed
size_t receiveSome (char* readBuffer, size_t length) throw(SSLSocketException)-
Receives data from the socket. Receives upto
length
bytes.
- Throws:
- SocketException if the connection was closed and the throw on close flag was set.
- Parameters:
- sendBuffer - [out] A buffer receiving the data
length - [in] The maximum number of bytes in the buffer
- Returns:
- The number of bytes received, -1 on error, and 0 if the connection was closed
void close () throw(SocketException)-
Closes the socket handle, and frees the SSL structures
Socket* clone () const -
Clones this object
- Returns:
- a new SSLSocket constructed from this object.
X509Certificate* getPeerCertificate ()-
Retreives the certificate of the peer
Note: The returned object must be freed by the caller
- Returns:
- the X509 cetificate of the peer.
int getVerifyResult ()-
Gets the result of performing a certificate verification
- Returns:
- The verify result.
std::string getErrorMessage ()-
Gets the SSL error message
- Returns:
- The SSL error message
void* getSSL ()-
Gets the SSL object cast as void
- Returns:
- the SSL object cast as void*.
SSLContext* getCTX ()-
Gets the SSLContext Object associated with the socket
- Returns:
- The SSLCOntext Object associated with the socket.
Table of Contents HTML hierarchy of classes or Java
Safmq Documentation, copyright (c) 2004-2010 Matthew J. Battey, Licensed Under Apache License Ver 2.0
Powered By: