glibmm: Gio::TlsClientConnection Class Reference

TLS client-side connection. More...

#include <giomm/tlsclientconnection.h>

Inheritance diagram for Gio::TlsClientConnection:

Public Member Functions

 TlsClientConnection (TlsClientConnection&& src) noexcept
 
TlsClientConnectionoperator= (TlsClientConnection&& src) noexcept
 
 ~TlsClientConnection () noexcept override
 
GTlsClientConnection* gobj ()
 Provides access to the underlying C GObject. More...

 
const GTlsClientConnection* gobj () const
 Provides access to the underlying C GObject. More...

 
void set_server_identity (const Glib::RefPtr< SocketConnectable >& identity)
 Sets conn's expected server identity, which is used both to tell servers on virtual hosts which certificate to present, and also to let conn know what name to look for in the certificate when performing Gio::TlsCertificateFlags::BAD_IDENTITY validation, if enabled. More...

 
Glib::RefPtr< SocketConnectableget_server_identity ()
 Gets conn's expected server identity. More...

 
Glib::RefPtr< const SocketConnectableget_server_identity () const
 Gets conn's expected server identity. More...

 
void set_validation_flags (TlsCertificateFlags flags)
 Sets conn's validation flags, to override the default set of checks performed when validating a server certificate. More...

 
TlsCertificateFlags get_validation_flags () const
 Gets conn's validation flags. More...

 
std::vector< Glib::RefPtr< Glib::ByteArray > > get_accepted_cas ()
 Gets the list of distinguished names of the Certificate Authorities that the server will accept certificates from. More...

 
std::vector< Glib::RefPtr< const Glib::ByteArray > > get_accepted_cas () const
 Gets the list of distinguished names of the Certificate Authorities that the server will accept certificates from. More...

 
void copy_session_state (const Glib::RefPtr< TlsClientConnection >& source)
 Possibly copies session state from one connection to another, for use in TLS session resumption. More...

 
Glib::PropertyProxy< Glib::RefPtr< SocketConnectable > > property_server_identity ()
 A SocketConnectable describing the identity of the server that is expected on the other end of the connection. More...

 
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< SocketConnectable > > property_server_identity () const
 A SocketConnectable describing the identity of the server that is expected on the other end of the connection. More...

 
Glib::PropertyProxy< TlsCertificateFlagsproperty_validation_flags ()
 What steps to perform when validating a certificate received from a server. More...

 
Glib::PropertyProxy_ReadOnly< TlsCertificateFlagsproperty_validation_flags () const
 What steps to perform when validating a certificate received from a server. More...

 
- Public Member Functions inherited from Glib::Interface
 Interface ()
 A Default constructor. More...

 
 Interface (Interface&& src) noexcept
 
Interfaceoperator= (Interface&& src) noexcept
 
 Interface (const Glib::Interface_Class& interface_class)
 Called by constructors of derived classes. More...

 
 Interface (GObject* castitem)
 Called by constructors of derived classes. More...

 
 ~Interface () noexcept override
 
 Interface (const Interface&)=delete
 
Interfaceoperator= (const Interface&)=delete
 
GObject* gobj ()
 
const GObject* gobj () const
 
- Public Member Functions inherited from Glib::ObjectBase
 ObjectBase (const ObjectBase&)=delete
 
ObjectBaseoperator= (const ObjectBase&)=delete
 
void set_property_value (const Glib::ustring& property_name, const Glib::ValueBase& value)
 You probably want to use a specific property_*() accessor method instead. More...

 
void get_property_value (const Glib::ustring& property_name, Glib::ValueBase& value) const
 You probably want to use a specific property_*() accessor method instead. More...

 
template<class PropertyType >
void set_property (const Glib::ustring& property_name, const PropertyType& value)
 You probably want to use a specific property_*() accessor method instead. More...

 
template<class PropertyType >
void get_property (const Glib::ustring& property_name, PropertyType& value) const
 You probably want to use a specific property_*() accessor method instead. More...

 
template<class PropertyType >
PropertyType get_property (const Glib::ustring& property_name) const
 You probably want to use a specific property_*() accessor method instead. More...

 
sigc::connection connect_property_changed (const Glib::ustring& property_name, const sigc::slot< void()>& slot)
 You can use the signal_changed() signal of the property proxy instead. More...

 
sigc::connection connect_property_changed (const Glib::ustring& property_name, sigc::slot< void()>&& slot)
 You can use the signal_changed() signal of the property proxy instead. More...

 
void freeze_notify ()
 Increases the freeze count on object. More...

 
void thaw_notify ()
 Reverts the effect of a previous call to freeze_notify(). More...

 
virtual void reference () const
 Increment the reference count for this object. More...

 
virtual void unreference () const
 Decrement the reference count for this object. More...

 
GObject* gobj ()
 Provides access to the underlying C GObject. More...

 
const GObject* gobj () const
 Provides access to the underlying C GObject. More...

 
GObject* gobj_copy () const
 Give a ref-ed copy to someone. Use for direct struct access. More...

 
- Public Member Functions inherited from sigc::trackable
 trackable () noexcept
 
 trackable (const trackable &src) noexcept
 
 trackable (trackable &&src) noexcept
 
 ~trackable ()
 
void add_destroy_notify_callback (notifiable *data, func_destroy_notify func) const
 
void notify_callbacks ()
 
trackableoperator= (const trackable &src)
 
trackableoperator= (trackable &&src) noexcept
 
void remove_destroy_notify_callback (notifiable *data) const
 

Static Public Member Functions

static void add_interface (GType gtype_implementer)
 
static GType get_type ()
 Get the GType for this class, for use with the underlying GObject type system. More...

 
static Glib::RefPtr< TlsClientConnectionImplcreate (const Glib::RefPtr< IOStream >& base_io_stream, const Glib::RefPtr< const SocketConnectable >& server_identity)
 Creates a new TlsClientConnection wrapping base_io_stream (which must have pollable input and output streams) which is assumed to communicate with the server identified by server_identity. More...

 
static Glib::RefPtr< TlsClientConnectionImplcreate (const Glib::RefPtr< IOStream >& base_io_stream)
 A create() convenience overload. More...

 

Protected Member Functions

 TlsClientConnection ()
 You should derive from this class to use it. More...

 
- Protected Member Functions inherited from Glib::ObjectBase
 ObjectBase ()
 This default constructor is called implicitly from the constructor of user-derived classes, even if, for instance, Gtk::Button calls a different ObjectBase constructor. More...

 
 ObjectBase (const char* custom_type_name)
 A derived constructor always overrides this choice. More...

 
 ObjectBase (const std::type_info& custom_type_info)
 This constructor is a special feature to allow creation of derived types on the fly, without having to use g_object_new() manually. More...

 
 ObjectBase (ObjectBase&& src) noexcept
 
ObjectBaseoperator= (ObjectBase&& src) noexcept
 
virtual ~ObjectBase () noexcept=0
 
void initialize (GObject* castitem)
 
void initialize_move (GObject* castitem, Glib::ObjectBase* previous_wrapper)
 

Related Functions

(Note that these are not member functions.)

Glib::RefPtr< Gio::TlsClientConnectionwrap (GTlsClientConnection* object, bool take_copy=false)
 A Glib::wrap() method for this object. More...

 

Additional Inherited Members

- Public Types inherited from sigc::trackable
typedef internal::func_destroy_notify func_destroy_notify
 
- Public Types inherited from sigc::notifiable
typedef internal::func_destroy_notify func_destroy_notify
 

Detailed Description

TLS client-side connection.

TlsClientConnection is the client-side subclass of TlsConnection, representing a client-side TLS connection.

Since glibmm 2.36:

Constructor & Destructor Documentation

Gio::TlsClientConnection::TlsClientConnection ( )
protected

You should derive from this class to use it.

Gio::TlsClientConnection::TlsClientConnection ( TlsClientConnection&&  src)
noexcept
Gio::TlsClientConnection::~TlsClientConnection ( )
overridenoexcept

Member Function Documentation

static void Gio::TlsClientConnection::add_interface ( GType  gtype_implementer)
static
void Gio::TlsClientConnection::copy_session_state ( const Glib::RefPtr< TlsClientConnection >&  source)

Possibly copies session state from one connection to another, for use in TLS session resumption.

This is not normally needed, but may be used when the same session needs to be used between different endpoints, as is required by some protocols, such as FTP over TLS. source should have already completed a handshake and, since TLS 1.3, it should have been used to read data at least once. conn should not have completed a handshake.

It is not possible to know whether a call to this function will actually do anything. Because session resumption is normally used only for performance benefit, the TLS backend might not implement this function. Even if implemented, it may not actually succeed in allowing conn to resume source's TLS session, because the server may not have sent a session resumption token to source, or it may refuse to accept the token from conn. There is no way to know whether a call to this function is actually successful.

Using this function is not required to benefit from session resumption. If the TLS backend supports session resumption, the session will be resumed automatically if it is possible to do so without weakening the privacy guarantees normally provided by TLS, without need to call this function. For example, with TLS 1.3, a session ticket will be automatically copied from any TlsClientConnection that has previously received session tickets from the server, provided a ticket is available that has not previously been used for session resumption, since session ticket reuse would be a privacy weakness. Using this function causes the ticket to be copied without regard for privacy considerations.

Since glibmm 2.46:
Parameters
sourceA TlsClientConnection.
static Glib::RefPtr<TlsClientConnectionImpl> Gio::TlsClientConnection::create ( const Glib::RefPtr< IOStream >&  base_io_stream,
const Glib::RefPtr< const SocketConnectable >&  server_identity 
)
static

Creates a new TlsClientConnection wrapping base_io_stream (which must have pollable input and output streams) which is assumed to communicate with the server identified by server_identity.

See the documentation for TlsConnection::property_base_io_stream() for restrictions on when application code can run operations on the base_io_stream after this function has returned.

Since glibmm 2.28:
Parameters
base_io_streamThe IOStream to wrap.
server_identityThe expected identity of the server.
Returns
The new TlsClientConnection, or nullptr on error.
Exceptions
Glib::Error
static Glib::RefPtr<TlsClientConnectionImpl> Gio::TlsClientConnection::create ( const Glib::RefPtr< IOStream >&  base_io_stream)
static

A create() convenience overload.

std::vector< Glib::RefPtr<Glib::ByteArray> > Gio::TlsClientConnection::get_accepted_cas ( )

Gets the list of distinguished names of the Certificate Authorities that the server will accept certificates from.

This will be set during the TLS handshake if the server requests a certificate. Otherwise, it will be nullptr.

Each item in the list is a ByteArray which contains the complete subject DN of the certificate authority.

Since glibmm 2.28:
Returns
The list of CA DNs.
std::vector< Glib::RefPtr<const Glib::ByteArray> > Gio::TlsClientConnection::get_accepted_cas ( ) const

Gets the list of distinguished names of the Certificate Authorities that the server will accept certificates from.

This will be set during the TLS handshake if the server requests a certificate. Otherwise, it will be nullptr.

Each item in the list is a ByteArray which contains the complete subject DN of the certificate authority.

Since glibmm 2.28:
Returns
The list of CA DNs.
Glib::RefPtr<SocketConnectable> Gio::TlsClientConnection::get_server_identity ( )

Gets conn's expected server identity.

Since glibmm 2.28:
Returns
A SocketConnectable describing the expected server identity, or nullptr if the expected identity is not known.
Glib::RefPtr<const SocketConnectable> Gio::TlsClientConnection::get_server_identity ( ) const

Gets conn's expected server identity.

Since glibmm 2.28:
Returns
A SocketConnectable describing the expected server identity, or nullptr if the expected identity is not known.
static GType Gio::TlsClientConnection::get_type ( )
static

Get the GType for this class, for use with the underlying GObject type system.

TlsCertificateFlags Gio::TlsClientConnection::get_validation_flags ( ) const

Gets conn's validation flags.

Since glibmm 2.28:
Returns
The validation flags.
GTlsClientConnection* Gio::TlsClientConnection::gobj ( )
inline

Provides access to the underlying C GObject.

const GTlsClientConnection* Gio::TlsClientConnection::gobj ( ) const
inline

Provides access to the underlying C GObject.

TlsClientConnection& Gio::TlsClientConnection::operator= ( TlsClientConnection&&  src)
noexcept
Glib::PropertyProxy< Glib::RefPtr<SocketConnectable> > Gio::TlsClientConnection::property_server_identity ( )

A SocketConnectable describing the identity of the server that is expected on the other end of the connection.

If the Gio::TlsCertificateFlags::BAD_IDENTITY flag is set in TlsClientConnection::property_validation_flags(), this object will be used to determine the expected identify of the remote end of the connection; if TlsClientConnection::property_server_identity() is not set, or does not match the identity presented by the server, then the Gio::TlsCertificateFlags::BAD_IDENTITY validation will fail.

In addition to its use in verifying the server certificate, this is also used to give a hint to the server about what certificate we expect, which is useful for servers that serve virtual hosts.

Since glibmm 2.28:
Returns
A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.
Glib::PropertyProxy_ReadOnly< Glib::RefPtr<SocketConnectable> > Gio::TlsClientConnection::property_server_identity ( ) const

A SocketConnectable describing the identity of the server that is expected on the other end of the connection.

If the Gio::TlsCertificateFlags::BAD_IDENTITY flag is set in TlsClientConnection::property_validation_flags(), this object will be used to determine the expected identify of the remote end of the connection; if TlsClientConnection::property_server_identity() is not set, or does not match the identity presented by the server, then the Gio::TlsCertificateFlags::BAD_IDENTITY validation will fail.

In addition to its use in verifying the server certificate, this is also used to give a hint to the server about what certificate we expect, which is useful for servers that serve virtual hosts.

Since glibmm 2.28:
Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.
Glib::PropertyProxy< TlsCertificateFlags > Gio::TlsClientConnection::property_validation_flags ( )

What steps to perform when validating a certificate received from a server.

Server certificates that fail to validate in any of the ways indicated here will be rejected unless the application overrides the default via TlsConnection::signal_accept_certificate().

Since glibmm 2.28:

Default value: Gio::TlsCertificateFlags::UNKNOWN_CA | Gio::TlsCertificateFlags::BAD_IDENTITY | Gio::TlsCertificateFlags::NOT_ACTIVATED | Gio::TlsCertificateFlags::EXPIRED | Gio::TlsCertificateFlags::REVOKED | Gio::TlsCertificateFlags::INSECURE | Gio::TlsCertificateFlags::GENERIC_ERROR

Returns
A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.
Glib::PropertyProxy_ReadOnly< TlsCertificateFlags > Gio::TlsClientConnection::property_validation_flags ( ) const

What steps to perform when validating a certificate received from a server.

Server certificates that fail to validate in any of the ways indicated here will be rejected unless the application overrides the default via TlsConnection::signal_accept_certificate().

Since glibmm 2.28:

Default value: Gio::TlsCertificateFlags::UNKNOWN_CA | Gio::TlsCertificateFlags::BAD_IDENTITY | Gio::TlsCertificateFlags::NOT_ACTIVATED | Gio::TlsCertificateFlags::EXPIRED | Gio::TlsCertificateFlags::REVOKED | Gio::TlsCertificateFlags::INSECURE | Gio::TlsCertificateFlags::GENERIC_ERROR

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.
void Gio::TlsClientConnection::set_server_identity ( const Glib::RefPtr< SocketConnectable >&  identity)

Sets conn's expected server identity, which is used both to tell servers on virtual hosts which certificate to present, and also to let conn know what name to look for in the certificate when performing Gio::TlsCertificateFlags::BAD_IDENTITY validation, if enabled.

Since glibmm 2.28:
Parameters
identityA SocketConnectable describing the expected server identity.
void Gio::TlsClientConnection::set_validation_flags ( TlsCertificateFlags  flags)

Sets conn's validation flags, to override the default set of checks performed when validating a server certificate.

By default, Gio::TlsCertificateFlags::VALIDATE_ALL is used.

Since glibmm 2.28:
Parameters
flagsThe TlsCertificateFlags to use.

Friends And Related Function Documentation

Glib::RefPtr< Gio::TlsClientConnection > wrap ( GTlsClientConnection *  object,
bool  take_copy = false 
)
related

A Glib::wrap() method for this object.

Parameters
objectThe C instance.
take_copyFalse if the result should take ownership of the C instance. True if it should take a new copy or ref.
Returns
A C++ instance that wraps this C instance.