gio.tls_connection
Module for [TlsConnection] class
Types 3
gio.tls_connection.TlsConnection is the base TLS connection class type, which wraps a gio.iostream.IOStream and provides TLS encryption on top of it. Its subclasses, gio.tls_client_connection.TlsClientConnection and gio.tls_server_connection.TlsServerConnection, implement client-side and server-side TLS, respectively.
For DTLS (Datagram TLS) support, see gio.dtls_connection.DtlsConnection.
Methods
TlsConnectionGidBuilder builder() static nothrowGet builder for [gio.tls_connection.TlsConnection] Returns: New builder objectgio.iostream.IOStream baseIoStream() @property nothrowGet `baseIoStream` property. Returns: The #GIOStream that the connection wraps. The connection holds a reference to this stream, and may run operations on the stream from other threads throughout i...gio.tls_certificate.TlsCertificate certificate() @property nothrowGet `certificate` property. Returns: The connection's certificate; see [gio.tls_connection.TlsConnection.setCertificate].void certificate(gio.tls_certificate.TlsCertificate propval) @property nothrowSet `certificate` property. Params: propval = The connection's certificate; see [gio.tls_connection.TlsConnection.setCertificate].string ciphersuiteName() @property nothrowGet `ciphersuiteName` property. Returns: The name of the TLS ciphersuite in use. See [gio.tls_connection.TlsConnection.getCiphersuiteName].gio.tls_database.TlsDatabase database() @property nothrowGet `database` property. Returns: The certificate database to use when verifying this TLS connection. If no certificate database is set, then the default database will be used. See [gio.tls_backend...void database(gio.tls_database.TlsDatabase propval) @property nothrowSet `database` property. Params: propval = The certificate database to use when verifying this TLS connection. If no certificate database is set, then the default database will be used. See [gio.tl...gio.tls_interaction.TlsInteraction interaction() @property nothrowGet `interaction` property. Returns: A #GTlsInteraction object to be used when the connection or certificate database need to interact with the user. This will be used to prompt the user for passwo...void interaction(gio.tls_interaction.TlsInteraction propval) @property nothrowSet `interaction` property. Params: propval = A #GTlsInteraction object to be used when the connection or certificate database need to interact with the user. This will be used to prompt the user f...string negotiatedProtocol() @property nothrowGet `negotiatedProtocol` property. Returns: The application-layer protocol negotiated during the TLS handshake. See [gio.tls_connection.TlsConnection.getNegotiatedProtocol].gio.tls_certificate.TlsCertificate peerCertificate() @property nothrowGet `peerCertificate` property. Returns: The connection's peer's certificate, after the TLS handshake has completed or failed. Note in particular that this is not yet set during the emission of #GT...gio.types.TlsCertificateFlags peerCertificateErrors() @property nothrowGet `peerCertificateErrors` property. Returns: The errors noticed while verifying #GTlsConnection:peer-certificate. Normally this should be 0, but it may not be if #GTlsClientConnection:validation-...gio.types.TlsProtocolVersion protocolVersion() @property nothrowGet `protocolVersion` property. Returns: The TLS protocol version in use. See [gio.tls_connection.TlsConnection.getProtocolVersion].gio.types.TlsRehandshakeMode rehandshakeMode() @property nothrowGet `rehandshakeMode` property. Returns: The rehandshaking mode. See [gio.tls_connection.TlsConnection.setRehandshakeMode].void rehandshakeMode(gio.types.TlsRehandshakeMode propval) @property nothrowSet `rehandshakeMode` property. Params: propval = The rehandshaking mode. See [gio.tls_connection.TlsConnection.setRehandshakeMode].bool requireCloseNotify() @property nothrowGet `requireCloseNotify` property. Returns: Whether or not proper TLS close notification is required. See [gio.tls_connection.TlsConnection.setRequireCloseNotify].void requireCloseNotify(bool propval) @property nothrowSet `requireCloseNotify` property. Params: propval = Whether or not proper TLS close notification is required. See [gio.tls_connection.TlsConnection.setRequireCloseNotify].bool useSystemCertdb() @property nothrowGet `useSystemCertdb` property. Returns: Whether or not the system certificate database will be used to verify peer certificates. See [gio.tls_connection.TlsConnection.setUseSystemCertdb].void useSystemCertdb(bool propval) @property nothrowSet `useSystemCertdb` property. Params: propval = Whether or not the system certificate database will be used to verify peer certificates. See [gio.tls_connection.TlsConnection.setUseSystemCertdb].bool emitAcceptCertificate(gio.tls_certificate.TlsCertificate peerCert, gio.types.TlsCertificateFlags errors) nothrowUsed by #GTlsConnection implementations to emit the #GTlsConnection::accept-certificate signal.gio.tls_certificate.TlsCertificate getCertificate() nothrowGets conn's certificate, as set by [gio.tls_connection.TlsConnection.setCertificate]. Returns: conn's certificate, or nullbool getChannelBindingData(gio.types.TlsChannelBindingType type, ref ubyte[] data)Query the TLS backend for TLS channel binding data of type for conn.string getCiphersuiteName() nothrowReturns the name of the current TLS ciphersuite, or null if the connection has not handshaked or has been closed. Beware that the TLS backend may use any of multiple different naming conventions, b...gio.tls_database.TlsDatabase getDatabase() nothrowGets the certificate database that conn uses to verify peer certificates. See [gio.tls_connection.TlsConnection.setDatabase]. Returns: the certificate database that conn uses or nullgio.tls_interaction.TlsInteraction getInteraction() nothrowGet the object that will be used to interact with the user. It will be used for things like prompting the user for passwords. If null is returned, then no user interaction will occur for this conne...string getNegotiatedProtocol() nothrowGets the name of the application-layer protocol negotiated during the handshake.gio.tls_certificate.TlsCertificate getPeerCertificate() nothrowGets conn's peer's certificate after the handshake has completed or failed. (It is not set during the emission of #GTlsConnection::accept-certificate.) Returns: conn's peer's certificate, or nullgio.types.TlsCertificateFlags getPeerCertificateErrors() nothrowGets the errors associated with validating conn's peer's certificate, after the handshake has completed or failed. (It is not set during the emission of #GTlsConnection::accept-certificate.)gio.types.TlsProtocolVersion getProtocolVersion() nothrowReturns the current TLS protocol version, which may be [gio.types.TlsProtocolVersion.Unknown] if the connection has not handshaked, or has been closed, or if the TLS backend has implemented a proto...gio.types.TlsRehandshakeMode getRehandshakeMode() nothrowGets conn rehandshaking mode. See [gio.tls_connection.TlsConnection.setRehandshakeMode] for details. Returns: [gio.types.TlsRehandshakeMode.Safely]bool getRequireCloseNotify() nothrowTests whether or not conn expects a proper TLS close notification when the connection is closed. See [gio.tls_connection.TlsConnection.setRequireCloseNotify] for details. Returns: true if conn requ...bool getUseSystemCertdb() nothrowGets whether conn uses the system certificate database to verify peer certificates. See [gio.tls_connection.TlsConnection.setUseSystemCertdb]. Returns: whether conn uses the system certificate data...bool handshake(gio.cancellable.Cancellable cancellable = null)Attempts a TLS handshake on conn.void handshakeAsync(int ioPriority, gio.cancellable.Cancellable cancellable = null, gio.types.AsyncReadyCallback callback = null) nothrowAsynchronously performs a TLS handshake on conn. See [gio.tls_connection.TlsConnection.handshake] for more information.bool handshakeFinish(gio.async_result.AsyncResult result)Finish an asynchronous TLS handshake operation. See [gio.tls_connection.TlsConnection.handshake] for more information.void setAdvertisedProtocols(string[] protocols = null) nothrowSets the list of application-layer protocols to advertise that the caller is willing to speak on this connection. The Application-Layer Protocol Negotiation (ALPN) extension will be used to negotia...void setCertificate(gio.tls_certificate.TlsCertificate certificate) nothrowThis sets the certificate that conn will present to its peer during the TLS handshake. For a #GTlsServerConnection, it is mandatory to set this, and that will normally be done at construct time.void setDatabase(gio.tls_database.TlsDatabase database = null) nothrowSets the certificate database that is used to verify peer certificates. This is set to the default database by default. See [gio.tls_backend.TlsBackend.getDefaultDatabase]. If set to null, then pee...void setInteraction(gio.tls_interaction.TlsInteraction interaction = null) nothrowSet the object that will be used to interact with the user. It will be used for things like prompting the user for passwords.void setRehandshakeMode(gio.types.TlsRehandshakeMode mode) nothrowSince GLib 2.64, changing the rehandshake mode is no longer supported and will have no effect. With TLS 1.3, rehandshaking has been removed from the TLS protocol, replaced by separate post-handshak...void setRequireCloseNotify(bool requireCloseNotify) nothrowSets whether or not conn expects a proper TLS close notification before the connection is closed. If this is true (the default), then conn will expect to receive a TLS close notification from its p...void setUseSystemCertdb(bool useSystemCertdb) nothrowSets whether conn uses the system certificate database to verify peer certificates. This is true by default. If set to false, then peer certificate validation will always set the [gio.types.TlsCert...gulong connectAcceptCertificate(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == bool)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gio.tls_certificate.TlsCertificate)))
&& (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] == gio.types.TlsCertificateFlags)))
&& (Parameters!T.length < 3 || (ParameterStorageClassTuple!T[2] == ParameterStorageClass.none && is(Parameters!T[2] : gio.tls_connection.TlsConnection)))
&& Parameters!T.length < 4) nothrowConnect to `AcceptCertificate` signal.Fluent builder implementation template for gio.tls_connection.TlsConnection
Methods
T baseIoStream(gio.iostream.IOStream propval) nothrowSet `baseIoStream` property. Params: propval = The #GIOStream that the connection wraps. The connection holds a reference to this stream, and may run operations on the stream from other threads thr...T certificate(gio.tls_certificate.TlsCertificate propval) nothrowSet `certificate` property. Params: propval = The connection's certificate; see [gio.tls_connection.TlsConnection.setCertificate]. Returns: Builder instance for fluent chainingT database(gio.tls_database.TlsDatabase propval) nothrowSet `database` property. Params: propval = The certificate database to use when verifying this TLS connection. If no certificate database is set, then the default database will be used. See [gio.tl...T interaction(gio.tls_interaction.TlsInteraction propval) nothrowSet `interaction` property. Params: propval = A #GTlsInteraction object to be used when the connection or certificate database need to interact with the user. This will be used to prompt the user f...T rehandshakeMode(gio.types.TlsRehandshakeMode propval) nothrowSet `rehandshakeMode` property. Params: propval = The rehandshaking mode. See [gio.tls_connection.TlsConnection.setRehandshakeMode]. Returns: Builder instance for fluent chainingT requireCloseNotify(bool propval) nothrowSet `requireCloseNotify` property. Params: propval = Whether or not proper TLS close notification is required. See [gio.tls_connection.TlsConnection.setRequireCloseNotify]. Returns: Builder instanc...T useSystemCertdb(bool propval) nothrowSet `useSystemCertdb` property. Params: propval = Whether or not the system certificate database will be used to verify peer certificates. See [gio.tls_connection.TlsConnection.setUseSystemCertdb]....Fluent builder for gio.tls_connection.TlsConnection
Methods