TLSContext

Encapsulates the configuration for an TLS tunnel.

Note that when creating an TLSContext with TLSContextKind.client, the peerValidationMode will be set to TLSPeerValidationMode.trustedCert, but no trusted certificate authorities are added by default. Use useTrustedCertificateFile to add those.

Members

Functions

createStream
TLSStream createStream(InterfaceProxy!Stream underlying, TLSStreamState state, string peer_name, NetworkAddress peer_address)

Creates a new stream associated to this context.

setCipherList
void setCipherList(string list)

Set the list of cipher specifications to use for TLS tunnels.

setClientALPN
void setClientALPN(string[] alpn)

Setter method invoked to offer ALPN (server side)

setDHParams
void setDHParams(string pem_file)

Set params to use for DH cipher.

setECDHCurve
void setECDHCurve(string curve)

Set the elliptic curve to use for ECDH cipher.

useCertificateChainFile
void useCertificateChainFile(string path)
void useCertificateChainFile(NativePath path)

Sets a certificate file to use for authenticating to the remote peer

usePrivateKeyFile
void usePrivateKeyFile(string path)
void usePrivateKeyFile(NativePath path)

Sets the private key to use for authenticating to the remote peer based on the configured certificate chain file.

useTrustedCertificateFile
void useTrustedCertificateFile(string path)

Sets the list of trusted certificates for verifying peer certificates.

Properties

alpnCallback
TLSALPNCallback alpnCallback [@property setter]
TLSALPNCallback alpnCallback [@property getter]

Callback function invoked to choose alpn (client side)

kind
TLSContextKind kind [@property getter]

The kind of TLS context (client/server)

maxCertChainLength
int maxCertChainLength [@property setter]
int maxCertChainLength [@property getter]

The maximum length of an accepted certificate chain.

peerValidationCallback
TLSPeerValidationCallback peerValidationCallback [@property setter]
inout(TLSPeerValidationCallback) peerValidationCallback [@property getter]

An optional user callback for peer validation.

peerValidationMode
TLSPeerValidationMode peerValidationMode [@property setter]
TLSPeerValidationMode peerValidationMode [@property getter]

Specifies the validation level of remote peers.

sniCallback
TLSServerNameCallback sniCallback [@property setter]
inout(TLSServerNameCallback) sniCallback [@property getter]

The callback used to associcate host names with TLS certificates/contexts.

Meta