SSLServerSocket

SSLServerSocket is a sub-class of ServerSocket. It's purpose is to provide SSL encryption at the socket level as well as easily tie into existing Tango applications that may already be using ServerSocket.

SSLServerSocket requires the OpenSSL library, and uses a dynamic binding to the library. You can find the library at http://www.openssl.org and a Win32 specific port at http://www.slproweb.com/products/Win32OpenSSL.html.

Example SSL server

auto cert = new Certificate(cast(char[])File.get("public.pem"));
auto pkey = new PrivateKey(cast(char[])File.get("private.pem"));
auto ctx = new SSLCtx;
ctx.certificate(cert).privateKey(pkey);
auto server = new SSLServerSocket(443, ctx);
for(;;)
{
    auto sc = server.accept;
    sc.write("HTTP/1.1 200\r\n\r\n<b>Hello World</b>");
    sc.shutdown.close;
}

Constructors

this
this(ushort port, SSLCtx ctx, int backlog, bool reuse)
this
this(Address addr, SSLCtx ctx, int backlog, bool reuse)

Constructs a new SSLServerSocket. This constructor is similar to ServerSocket, except it takes a SSLCtx as provided by PKI.

Members

Aliases

accept
alias accept = ServerSocket.accept
Undocumented in source.

Functions

accept
SSLSocket accept(SSLSocket recipient)

Accepts a new connection and copies the provided server SSLCtx to a new SSLSocket.

Inherited Members

From ServerSocket

toString
string toString()

Return the name of this device

accept
Socket accept(Socket recipient)

Meta