Module vibe.stream.ssl
SSL/TLS stream implementation
SSLStream
can be used to implement SSL/TLS communication on top of a TCP connection. The
SSLContextKind
of an SSLStream
determines if the SSL tunnel is established actively (client) or
passively (server).
Example
A simple SSL client
import vibe.core.net; import vibe.stream.ssl; void sendSSLMessage() { auto conn = connectTCP("127.0.0.1", 1234); auto sslctx = new SSLContext(SSLContextKind.client); auto stream = new SSLStream(conn, sslctx); stream.write("Hello, World!"); stream.finalize(); conn.close(); }
Example
Corresponding server
import vibe.core.log; import vibe.core.net; import vibe.stream.operations; import vibe.stream.ssl; void listenForSSL() { auto sslctx = new SSLContext(SSLContextKind.server); sslctx.useCertificateChainFile("server.crt"); sslctx.usePrivateKeyFile("server.key"); listenTCP(1234, (conn){ auto stream = new SSLStream(conn, sslctx); logInfo("Got message: %s", stream.readAllUTF8()); stream.finalize(); }); }
Functions
Name | Description |
---|---|
createSSLContext
|
Creates a new context of the given kind .
|
createSSLStream
|
Constructs a new SSL tunnel and infers the stream state from the SSLContextKind .
|
createSSLStream
|
Constructs a new SSL tunnel, allowing to override the stream state .
|
Classes
Name | Description |
---|---|
SSLContext
|
Encapsulates the configuration for an SSL tunnel. |
SSLStream
|
Creates an SSL/TLS tunnel within an existing stream. |
Structs
Name | Description |
---|---|
SSLPeerValidationData
|
Enums
Name | Description |
---|---|
SSLContextKind
|
|
SSLPeerValidationMode
|
Specifies how rigorously SSL peer certificates are validated. |
SSLStreamState
|
|
SSLVersion
|
Aliases
Name | Type | Description |
---|---|---|
SslContext
|
SSLContext
|
Deprecated compatibility alias |
SSLPeerValidationCallback
|
bool delegate(scope SSLPeerValidationData)
|
|
SSLState
|
deimos.openssl.ssl.ssl_st*
|
|
SslStream
|
SSLStream
|
Deprecated compatibility alias |
SslStreamState
|
SSLStreamState
|
Deprecated compatibility alias |
Authors
Sönke Ludwig
Copyright
© 2012-2014 RejectedSoftware e.K.
License
Subject to the terms of the MIT license, as written in the included LICENSE.txt file.