Class: Gio::TlsConnection

Inherits:
Object
  • Object
show all
Defined in:
(unknown)

Instance Method Summary collapse

Instance Method Details

#advertised_protocolsGio::

The list of application-layer protocols that the connection advertises that it is willing to speak. See g_tls_connection_set_advertised_protocols().

Returns:

  • (Gio::)

    advertised-protocols

#advertised_protocols=(advertised_protocols) ⇒ Gio::

The list of application-layer protocols that the connection advertises that it is willing to speak. See g_tls_connection_set_advertised_protocols().

Parameters:

  • advertised_protocols (Gio::)

Returns:

  • (Gio::)

    advertised-protocols

  • (Gio::)

    advertised-protocols

#base_io_streamGio::IOStream

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 its lifetime. Consequently, after the #GIOStream has been constructed, application code may only run its own operations on this stream when no #GIOStream operations are running.

Returns:

#base_io_stream=(base_io_stream) ⇒ Gio::IOStream

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 its lifetime. Consequently, after the #GIOStream has been constructed, application code may only run its own operations on this stream when no #GIOStream operations are running.

Parameters:

Returns:

#certificateGio::TlsCertificate

The connection’s certificate; see g_tls_connection_set_certificate().

Returns:

#certificate=(certificate) ⇒ Gio::TlsCertificate

The connection’s certificate; see g_tls_connection_set_certificate().

Parameters:

Returns:

#databaseGio::TlsDatabase

The certificate database to use when verifying this TLS connection. If no certificate database is set, then the default database will be used. See g_tls_backend_get_default_database().

Returns:

#database=(database) ⇒ Gio::TlsDatabase

The certificate database to use when verifying this TLS connection. If no certificate database is set, then the default database will be used. See g_tls_backend_get_default_database().

Parameters:

Returns:

#emit_accept_certificate(peer_cert, errors) ⇒ TrueClass

Used by GTls::Connection implementations to emit the GTls::Connection::accept-certificate signal.

Parameters:

Returns:

  • (TrueClass)

    true if one of the signal handlers has returned true to accept peer_cert

#handshake(cancellable) ⇒ TrueClass

Attempts a TLS handshake on conn.

On the client side, it is never necessary to call this method; although the connection needs to perform a handshake after connecting (or after sending a “STARTTLS”-type command), GTls::Connection will handle this for you automatically when you try to send or receive data on the connection. You can call g_tls_connection_handshake() manually if you want to know whether the initial handshake succeeded or failed (as opposed to just immediately trying to use conn to read or write, in which case, if it fails, it may not be possible to tell if it failed before or after completing the handshake), but beware that servers may reject client authentication after the handshake has completed, so a successful handshake does not indicate the connection will be usable.

Likewise, on the server side, although a handshake is necessary at the beginning of the communication, you do not need to call this function explicitly unless you want clearer error reporting.

Previously, calling g_tls_connection_handshake() after the initial handshake would trigger a rehandshake; however, this usage was deprecated in GLib 2.60 because rehandshaking was removed from the TLS protocol in TLS 1.3. Since GLib 2.64, calling this function after the initial handshake will no longer do anything.

When using a GTls::Connection created by #GSocketClient, the GSocket::Client performs the initial handshake, so calling this function manually is not recommended.

GTls::Connection::accept_certificate may be emitted during the handshake.

Parameters:

Returns:

  • (TrueClass)

    success or failure

#handshake_async(io_priority, cancellable, callback, user_data) ⇒ nil

Asynchronously performs a TLS handshake on conn. See g_tls_connection_handshake() for more information.

Parameters:

  • io_priority (Integer)

    the [I/O priority] of the request

  • cancellable (Gio::Cancellable)

    a #GCancellable, or nil

  • callback (Gio::AsyncReadyCallback)

    callback to call when the handshake is complete

  • user_data (GObject)

    the data to pass to the callback function

Returns:

  • (nil)

#handshake_finish(result) ⇒ TrueClass

Finish an asynchronous TLS handshake operation. See g_tls_connection_handshake() for more information. case error will be set.

Parameters:

Returns:

  • (TrueClass)

    true on success, false on failure, in which

#interactionGio::TlsInteraction

A GTls::Interaction 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 passwords where necessary.

Returns:

#interaction=(interaction) ⇒ Gio::TlsInteraction

A GTls::Interaction 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 passwords where necessary.

Parameters:

Returns:

#negotiated_protocolString

The application-layer protocol negotiated during the TLS handshake. See g_tls_connection_get_negotiated_protocol().

Returns:

  • (String)

    negotiated-protocol

#negotiated_protocol=(negotiated_protocol) ⇒ String

The application-layer protocol negotiated during the TLS handshake. See g_tls_connection_get_negotiated_protocol().

Parameters:

  • negotiated_protocol (String)

Returns:

  • (String)

    negotiated-protocol

  • (String)

    negotiated-protocol

#peer_certificateGio::TlsCertificate

The connection’s peer’s certificate, after the TLS handshake has completed and the certificate has been accepted. Note in particular that this is not yet set during the emission of GTls::Connection::accept-certificate.

(You can watch for a #GObject::notify signal on this property to detect when a handshake has occurred.)

Returns:

#peer_certificate=(peer_certificate) ⇒ Gio::TlsCertificate

The connection’s peer’s certificate, after the TLS handshake has completed and the certificate has been accepted. Note in particular that this is not yet set during the emission of GTls::Connection::accept-certificate.

(You can watch for a #GObject::notify signal on this property to detect when a handshake has occurred.)

Parameters:

Returns:

#peer_certificate_errorsGio::TlsCertificateFlags

The errors noticed-and-ignored while verifying GTls::Connection:peer-certificate. Normally this should be 0, but it may not be if GTls::ClientConnection:validation-flags is not %G_TLS_CERTIFICATE_VALIDATE_ALL, or if GTls::Connection::accept-certificate overrode the default behavior.

Returns:

#peer_certificate_errors=(peer_certificate_errors) ⇒ Gio::TlsCertificateFlags

The errors noticed-and-ignored while verifying GTls::Connection:peer-certificate. Normally this should be 0, but it may not be if GTls::ClientConnection:validation-flags is not %G_TLS_CERTIFICATE_VALIDATE_ALL, or if GTls::Connection::accept-certificate overrode the default behavior.

Parameters:

Returns:

#rehandshake_modeGio::TlsRehandshakeMode

The rehandshaking mode. See g_tls_connection_set_rehandshake_mode().

Returns:

#rehandshake_mode=(rehandshake_mode) ⇒ Gio::TlsRehandshakeMode

The rehandshaking mode. See g_tls_connection_set_rehandshake_mode().

Parameters:

Returns:

#require_close_notifyTrueClass

Tests whether or not conn expects a proper TLS close notification when the connection is closed. See g_tls_connection_set_require_close_notify() for details. notification.

Returns:

  • (TrueClass)

    true if conn requires a proper TLS close

#require_close_notify=(require_close_notify) ⇒ TrueClass

Whether or not proper TLS close notification is required. See g_tls_connection_set_require_close_notify().

Parameters:

  • require_close_notify (TrueClass)

Returns:

  • (TrueClass)

    require-close-notify

  • (TrueClass)

    require-close-notify

#require_close_notify?TrueClass

Whether or not proper TLS close notification is required. See g_tls_connection_set_require_close_notify().

Returns:

  • (TrueClass)

    require-close-notify

#use_system_certdbTrueClass

Gets whether conn uses the system certificate database to verify peer certificates. See g_tls_connection_set_use_system_certdb().

Returns:

  • (TrueClass)

    whether conn uses the system certificate database

#use_system_certdb=(use_system_certdb) ⇒ TrueClass

Whether or not the system certificate database will be used to verify peer certificates. See g_tls_connection_set_use_system_certdb().

Parameters:

  • use_system_certdb (TrueClass)

Returns:

  • (TrueClass)

    use-system-certdb

  • (TrueClass)

    use-system-certdb

#use_system_certdb?TrueClass

Whether or not the system certificate database will be used to verify peer certificates. See g_tls_connection_set_use_system_certdb().

Returns:

  • (TrueClass)

    use-system-certdb