yaSSL API ReferenceClient SideThe yaSSL Client side API is declared in namespace yaSSL and is centered on
the Client class. A "hello yaSSL" example will prove useful in showing
the most basic usage.
yaSSL::Client client;
The Client class is declared in yassl.hpp, which doesn't include any
headers itself. No arguments are needed for the constructor, and the only
option that is usually set is for Certificate Authority files. These are
Certificates that yaSSL will use for verification purposes. After that, the
client object only needs a connected socket to perform an SSL connect. yaSSL
uses the SOCKET_T type which is used for the differences between BSD
style sockets and Windows ones. Please see test.hpp which includes
tcp_connect(), all the examples use this function to perform TCP
connects. The socket is the only parameter Connect() takes, its
prototype is:
int Connect(SOCKET_T s);
Error handling has been omitted for clarity. Once an SSL connection has been
established, transferring data is simple. Two functions handle the needs:
int Write(const void*, int);
Once you are done using the Client connection, simply let the object go out of scope (or delete it if it's on the heap), the destructor takes care of closing the connection and cleaning up any memory use. It's that easy. Server SideThe server side yaSSL API is also in namespace yaSSL and is based on the
Server class, declared in yassl.hpp. All of the same functions as the
Client are supported, and the use is exactly the same. Two other
functions are needed to control the Server's certificates:
void SetCert(const char*);
Please see the examples for a complete example. |