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
TlsConnection self()Returns `this`, for use in `with` statements.TlsConnectionGidBuilder builder()Get builder for [gio.tls_connection.TlsConnection] Returns: New builder objectgio.iostream.IOStream baseIoStream() @propertyGet `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() @propertyGet `certificate` property. Returns: The connection's certificate; see [gio.tls_connection.TlsConnection.setCertificate].void certificate(gio.tls_certificate.TlsCertificate propval) @propertySet `certificate` property. Params: propval = The connection's certificate; see [gio.tls_connection.TlsConnection.setCertificate].string ciphersuiteName() @propertyGet `ciphersuiteName` property. Returns: The name of the TLS ciphersuite in use. See [gio.tls_connection.TlsConnection.getCiphersuiteName].gio.tls_database.TlsDatabase database() @propertyGet `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) @propertySet `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() @propertyGet `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) @propertySet `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() @propertyGet `negotiatedProtocol` property. Returns: The application-layer protocol negotiated during the TLS handshake. See [gio.tls_connection.TlsConnection.getNegotiatedProtocol].gio.tls_certificate.TlsCertificate peerCertificate() @propertyGet `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() @propertyGet `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() @propertyGet `protocolVersion` property. Returns: The TLS protocol version in use. See [gio.tls_connection.TlsConnection.getProtocolVersion].gio.types.TlsRehandshakeMode rehandshakeMode() @propertyGet `rehandshakeMode` property. Returns: The rehandshaking mode. See [gio.tls_connection.TlsConnection.setRehandshakeMode].void rehandshakeMode(gio.types.TlsRehandshakeMode propval) @propertySet `rehandshakeMode` property. Params: propval = The rehandshaking mode. See [gio.tls_connection.TlsConnection.setRehandshakeMode].bool requireCloseNotify() @propertyGet `requireCloseNotify` property. Returns: Whether or not proper TLS close notification is required. See [gio.tls_connection.TlsConnection.setRequireCloseNotify].void requireCloseNotify(bool propval) @propertySet `requireCloseNotify` property. Params: propval = Whether or not proper TLS close notification is required. See [gio.tls_connection.TlsConnection.setRequireCloseNotify].bool useSystemCertdb() @propertyGet `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) @propertySet `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)Used by #GTlsConnection implementations to emit the #GTlsConnection::accept-certificate signal.gio.tls_certificate.TlsCertificate getCertificate()Gets 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()Returns 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()Gets 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()Get 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()Gets the name of the application-layer protocol negotiated during the handshake.gio.tls_certificate.TlsCertificate getPeerCertificate()Gets 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()Gets 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()Returns 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()Gets conn rehandshaking mode. See [gio.tls_connection.TlsConnection.setRehandshakeMode] for details. Returns: [gio.types.TlsRehandshakeMode.Safely]bool getRequireCloseNotify()Tests 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()Gets 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)Asynchronously 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)Sets 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)This 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)Sets 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)Set 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)Since 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)Sets 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)Sets 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)Connect to `AcceptCertificate` signal.Methods
T baseIoStream(gio.iostream.IOStream propval)Set `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)Set `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)Set `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)Set `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)Set `rehandshakeMode` property. Params: propval = The rehandshaking mode. See [gio.tls_connection.TlsConnection.setRehandshakeMode]. Returns: Builder instance for fluent chainingT requireCloseNotify(bool propval)Set `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)Set `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