TlsConnection
Object Hierarchy:
Description:
[ CCode ( type_id = "g_tls_connection_get_type ()" ) ]
[ Version ( since = "2.28" ) ]
public abstract class TlsConnection : IOStream
[ Version ( since = "2.28" ) ]
public abstract class TlsConnection : IOStream
`GTlsConnection` is the base TLS connection class type, which wraps a [class@Gio.
IOStream] and provides TLS encryption on top of it. Its subclasses, [iface@Gio.TlsClientConnection] and [iface@Gio.TlsServerConnection], implement client-side and server-side TLS, respectively.
For DTLS (Datagram TLS) support, see [iface@Gio.DtlsConnection].
Required by:
Namespace: GLib
Package: gio-2.0
Content:
Properties:
- public string[] advertised_protocols { owned get; set; }
The list of application-layer protocols that the connection advertises that it is willing to speak.
- public IOStream base_io_stream { owned get; construct; }
The IOStream that the connection wraps.
- public TlsCertificate certificate { get; set; }
The connection's certificate; see set_certificate.
- public string ciphersuite_name { owned get; }
The name of the TLS ciphersuite in use.
- public TlsDatabase database { get; set; }
The certificate database to use when verifying this TLS connection.
- public TlsInteraction interaction { get; set; }
A TlsInteraction object to be used when the connection or certificate database need to interact with the user.
- public string negotiated_protocol { get; }
The application-layer protocol negotiated during the TLS handshake.
- public TlsCertificate peer_certificate { get; }
The connection's peer's certificate, after the TLS handshake has completed or failed.
- public TlsCertificateFlags peer_certificate_errors { get; }
The errors noticed while verifying peer_certificate.
- public TlsProtocolVersion protocol_version { get; }
The TLS protocol version in use.
- public TlsRehandshakeMode rehandshake_mode { get; set construct; }
The rehandshaking mode.
- public bool require_close_notify { get; set construct; }
Whether or not proper TLS close notification is required.
- public bool use_system_certdb { get; set construct; }
Whether or not the system certificate database will be used to verify peer certificates.
Creation methods:
- protected TlsConnection ()
Methods:
- public bool emit_accept_certificate (TlsCertificate peer_cert, TlsCertificateFlags errors)
Used by TlsConnection implementations to emit the accept_certificate signal.
- public unowned TlsCertificate? get_certificate ()
Gets this's certificate, as set by set_certificate.
- public virtual bool get_channel_binding_data (TlsChannelBindingType type, out unowned ByteArray data) throws TlsChannelBindingError
Query the TLS backend for TLS channel binding data of
type
for this. - public string? get_ciphersuite_name ()
Returns the name of the current TLS ciphersuite, or null if the connection has not handshaked or has been closed.
- public unowned TlsDatabase? get_database ()
Gets the certificate database that this uses to verify peer certificates.
- public unowned TlsInteraction? get_interaction ()
Get the object that will be used to interact with the user.
- public virtual unowned string? get_negotiated_protocol ()
Gets the name of the application-layer protocol negotiated during the handshake.
- public unowned TlsCertificate? get_peer_certificate ()
Gets this's peer's certificate after the handshake has completed or failed.
- public TlsCertificateFlags get_peer_certificate_errors ()
Gets the errors associated with validating this 's peer's certificate, after the handshake has completed or failed.
- public TlsProtocolVersion get_protocol_version ()
Returns the current TLS protocol version, which may be g_tls_protocol_version_unknown if the connection has not handshaked, or has been closed, or if the TLS backend has implemented a protocol version that is not a recognized TlsProtocolVersion.
- public TlsRehandshakeMode get_rehandshake_mode ()
Gets this rehandshaking mode.
- public bool get_require_close_notify ()
Tests whether or not this expects a proper TLS close notification when the connection is closed.
- public bool get_use_system_certdb ()
Gets whether this uses the system certificate database to verify peer certificates.
- public virtual bool handshake (Cancellable? cancellable = null) throws Error
Attempts a TLS handshake on this.
- public virtual async bool handshake_async (int io_priority = DEFAULT, Cancellable? cancellable = null) throws Error
Asynchronously performs a TLS handshake on this .
- public void set_advertised_protocols (string[]? protocols)
Sets the list of application-layer protocols to advertise that the caller is willing to speak on this connection.
- public void set_certificate (TlsCertificate certificate)
This sets the certificate that this will present to its peer during the TLS handshake.
- public void set_database (TlsDatabase? database)
Sets the certificate database that is used to verify peer certificates.
- public void set_interaction (TlsInteraction? interaction)
Set the object that will be used to interact with the user.
- public void set_rehandshake_mode (TlsRehandshakeMode mode)
Since GLib 2.64, changing the rehandshake mode is no longer supported and will have no effect.
- public void set_require_close_notify (bool require_close_notify)
Sets whether or not this expects a proper TLS close notification before the connection is closed.
- public void set_use_system_certdb (bool use_system_certdb)
Sets whether this uses the system certificate database to verify peer certificates.
Signals:
- public virtual signal bool accept_certificate (TlsCertificate peer_cert, TlsCertificateFlags errors)
Emitted during the TLS handshake after the peer certificate has been received.
Inherited Members:
All known members inherited from class GLib.IOStream
All known members inherited from class GLib.Object