SSLCtx

SSLCtx is provided to SSLSocket and SSLServerSocket.

It contains the public/private keypair, and some additional options that control how the SSL streams work.

Example

auto cert = new Certificate(cast(char[])File("public.pem").read);
auto pkey = new PrivateKey(cast(char[])File("private.pem").read);;
auto ctx = new SSLCtx();
ctx.certificate = cert;
ctx.pkey = pkey;
ctx.checkKey();

Constructors

this
this()

Creates a new SSLCtx supporting SSLv3 and TLSv1 methods.

Destructor

~this
~this()
Undocumented in source.

Members

Functions

caCertsPath
SSLCtx caCertsPath(const(char)[] path)

Loads valid Certificate Authorities from the specified path.

certificate
SSLCtx certificate(Certificate cert)

Assigns a X509 Certificate to the SSLCtx.

privateKey
SSLCtx privateKey(PrivateKey key)

Assigns a PrivateKey (public/private keypair to the SSLCtx.

setVerification
SSLCtx setVerification(int flags, SSLVerifyCallback cb)

Sets a SSLVerifyCallback function using the SSL_VERIFY_(NONE|PEER|etc) flags to control how verification is handled.

store
SSLCtx store(CertificateStore store)

Sets a CertificateStore of certs that are valid and trust Certificate Authorities during verification.

Properties

checkKey
SSLCtx checkKey [@property getter]

Validates that the X509 certificate was signed with the provided public/private keypair. Throws an exception if this is not the case.

native
SSL_CTX* native [@property getter]

Return the native context from OpenSSL

Meta