Blame docs/reference/gio/html/GTlsClientConnection.html

Packit ae235b
Packit ae235b
<html>
Packit ae235b
<head>
Packit ae235b
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
Packit ae235b
<title>GTlsClientConnection: GIO Reference Manual</title>
Packit ae235b
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
Packit ae235b
<link rel="home" href="index.html" title="GIO Reference Manual">
Packit ae235b
<link rel="up" href="tls.html" title="TLS (SSL) support">
Packit ae235b
<link rel="prev" href="GTlsConnection.html" title="GTlsConnection">
Packit ae235b
<link rel="next" href="GTlsServerConnection.html" title="GTlsServerConnection">
Packit ae235b
<meta name="generator" content="GTK-Doc V1.27 (XML mode)">
Packit ae235b
<link rel="stylesheet" href="style.css" type="text/css">
Packit ae235b
</head>
Packit ae235b
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
Packit ae235b
Packit ae235b
Packit ae235b
Top  | 
Packit ae235b
                  Description  | 
Packit ae235b
                  Object Hierarchy  | 
Packit ae235b
                  Prerequisites  | 
Packit ae235b
                  Properties
Packit ae235b
Packit ae235b
Home
Packit ae235b
Up
Packit ae235b
Prev
Packit ae235b
Next
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

GTlsClientConnection

Packit ae235b

GTlsClientConnection — TLS client-side connection

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Functions

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
GIOStream *
Packit ae235b
Packit ae235b
Packit ae235b
g_tls_client_connection_new ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
void
Packit ae235b
Packit ae235b
Packit ae235b
g_tls_client_connection_set_server_identity ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
GSocketConnectable *
Packit ae235b
Packit ae235b
Packit ae235b
g_tls_client_connection_get_server_identity ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
void
Packit ae235b
Packit ae235b
Packit ae235b
g_tls_client_connection_set_validation_flags ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
GTlsCertificateFlags
Packit ae235b
Packit ae235b
Packit ae235b
g_tls_client_connection_get_validation_flags ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
void
Packit ae235b
Packit ae235b
Packit ae235b
g_tls_client_connection_set_use_ssl3 ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
gboolean
Packit ae235b
Packit ae235b
Packit ae235b
g_tls_client_connection_get_use_ssl3 ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
GList *
Packit ae235b
Packit ae235b
Packit ae235b
g_tls_client_connection_get_accepted_cas ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
void
Packit ae235b
Packit ae235b
Packit ae235b
g_tls_client_connection_copy_session_state ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Properties

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
gpointer
Packit ae235b
accepted-cas
Packit ae235b
Read
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
GSocketConnectable *
Packit ae235b
server-identity
Packit ae235b
Read / Write / Construct
Packit ae235b
Packit ae235b
Packit ae235b
gboolean
Packit ae235b
use-ssl3
Packit ae235b
Read / Write / Construct
Packit ae235b
Packit ae235b
Packit ae235b
GTlsCertificateFlags
Packit ae235b
validation-flags
Packit ae235b
Read / Write / Construct
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Types and Values

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
 
Packit ae235b
GTlsClientConnection
Packit ae235b
Packit ae235b
Packit ae235b
struct
Packit ae235b
GTlsClientConnectionInterface
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Object Hierarchy

Packit ae235b
    GInterface
Packit ae235b
    ╰── GTlsClientConnection
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Prerequisites

Packit ae235b

Packit ae235b
GTlsClientConnection requires
Packit ae235b
 GTlsConnection.

Packit ae235b
Packit ae235b
Packit ae235b

Includes

Packit ae235b
#include <gio/gio.h>
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Description

Packit ae235b

GTlsClientConnection is the client-side subclass of

Packit ae235b
GTlsConnection, representing a client-side TLS connection.

Packit ae235b
Packit ae235b
Packit ae235b

Functions

Packit ae235b
Packit ae235b

g_tls_client_connection_new ()

Packit ae235b
GIOStream *
Packit ae235b
g_tls_client_connection_new (GIOStream *base_io_stream,
Packit ae235b
                             GSocketConnectable *server_identity,
Packit ae235b
                             GError **error);
Packit ae235b

Creates a new GTlsClientConnection wrapping base_io_stream

Packit ae235b
 (which
Packit ae235b
must have pollable input and output streams) which is assumed to
Packit ae235b
communicate with the server identified by server_identity
Packit ae235b
.

Packit ae235b

See the documentation for “base-io-stream” for restrictions

Packit ae235b
on when application code can run operations on the base_io_stream
Packit ae235b
 after
Packit ae235b
this function has returned.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

base_io_stream

Packit ae235b

the GIOStream to wrap

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

server_identity

Packit ae235b

the expected identity of the server.

Packit ae235b
[nullable]
Packit ae235b
Packit ae235b
Packit ae235b

error

Packit ae235b

GError for error reporting, or NULL to ignore.

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Returns

Packit ae235b

the new

Packit ae235b
GTlsClientConnection, or NULL on error. 

Packit ae235b

[transfer full][type GTlsClientConnection]

Packit ae235b
Packit ae235b

Since: 2.28

Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_tls_client_connection_set_server_identity ()

Packit ae235b
void
Packit ae235b
g_tls_client_connection_set_server_identity
Packit ae235b
                               (GTlsClientConnection *conn,
Packit ae235b
                                GSocketConnectable *identity);
Packit ae235b

Sets conn

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

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

conn

Packit ae235b

the GTlsClientConnection

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

identity

Packit ae235b

a GSocketConnectable describing the expected server identity

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Since: 2.28

Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_tls_client_connection_get_server_identity ()

Packit ae235b
GSocketConnectable *
Packit ae235b
g_tls_client_connection_get_server_identity
Packit ae235b
                               (GTlsClientConnection *conn);
Packit ae235b

Gets conn

Packit ae235b
's expected server identity

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

conn

Packit ae235b

the GTlsClientConnection

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Returns

Packit ae235b

a GSocketConnectable describing the

Packit ae235b
expected server identity, or NULL if the expected identity is not
Packit ae235b
known. 

Packit ae235b

[transfer none]

Packit ae235b
Packit ae235b

Since: 2.28

Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_tls_client_connection_set_validation_flags ()

Packit ae235b
void
Packit ae235b
g_tls_client_connection_set_validation_flags
Packit ae235b
                               (GTlsClientConnection *conn,
Packit ae235b
                                GTlsCertificateFlags flags);
Packit ae235b

Sets conn

Packit ae235b
's validation flags, to override the default set of
Packit ae235b
checks performed when validating a server certificate. By default,
Packit ae235b
G_TLS_CERTIFICATE_VALIDATE_ALL is used.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

conn

Packit ae235b

the GTlsClientConnection

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

flags

Packit ae235b

the GTlsCertificateFlags to use

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Since: 2.28

Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_tls_client_connection_get_validation_flags ()

Packit ae235b
GTlsCertificateFlags
Packit ae235b
g_tls_client_connection_get_validation_flags
Packit ae235b
                               (GTlsClientConnection *conn);
Packit ae235b

Gets conn

Packit ae235b
's validation flags

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

conn

Packit ae235b

the GTlsClientConnection

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Returns

Packit ae235b

the validation flags

Packit ae235b
Packit ae235b

Since: 2.28

Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_tls_client_connection_set_use_ssl3 ()

Packit ae235b
void
Packit ae235b
g_tls_client_connection_set_use_ssl3 (GTlsClientConnection *conn,
Packit ae235b
                                      gboolean use_ssl3);
Packit ae235b
Packit ae235b

g_tls_client_connection_set_use_ssl3 has been deprecated since version 2.56 and should not be used in newly-written code.

Packit ae235b

SSL 3.0 is insecure, and this function does not

Packit ae235b
generally enable or disable it, despite its name.

Packit ae235b
Packit ae235b

If use_ssl3

Packit ae235b
 is TRUE, this forces conn
Packit ae235b
 to use the lowest-supported
Packit ae235b
TLS protocol version rather than trying to properly negotiate the
Packit ae235b
highest mutually-supported protocol version with the peer. This can
Packit ae235b
be used when talking to broken TLS servers that exhibit protocol
Packit ae235b
version intolerance.

Packit ae235b

Be aware that SSL 3.0 is generally disabled by the GTlsBackend, so

Packit ae235b
the lowest-supported protocol version is probably not SSL 3.0.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

conn

Packit ae235b

the GTlsClientConnection

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

use_ssl3

Packit ae235b

whether to use the lowest-supported protocol version

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Since: 2.28

Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_tls_client_connection_get_use_ssl3 ()

Packit ae235b
gboolean
Packit ae235b
g_tls_client_connection_get_use_ssl3 (GTlsClientConnection *conn);
Packit ae235b
Packit ae235b

g_tls_client_connection_get_use_ssl3 has been deprecated since version 2.56 and should not be used in newly-written code.

Packit ae235b

SSL 3.0 is insecure, and this function does not

Packit ae235b
actually indicate whether it is enabled.

Packit ae235b
Packit ae235b

Gets whether conn

Packit ae235b
 will force the lowest-supported TLS protocol
Packit ae235b
version rather than attempt to negotiate the highest mutually-
Packit ae235b
supported version of TLS; see g_tls_client_connection_set_use_ssl3().

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

conn

Packit ae235b

the GTlsClientConnection

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Returns

Packit ae235b

whether conn

Packit ae235b
will use the lowest-supported TLS protocol version

Packit ae235b
Packit ae235b

Since: 2.28

Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_tls_client_connection_get_accepted_cas ()

Packit ae235b
GList *
Packit ae235b
g_tls_client_connection_get_accepted_cas
Packit ae235b
                               (GTlsClientConnection *conn);
Packit ae235b

Gets the list of distinguished names of the Certificate Authorities

Packit ae235b
that the server will accept certificates from. This will be set
Packit ae235b
during the TLS handshake if the server requests a certificate.
Packit ae235b
Otherwise, it will be NULL.

Packit ae235b

Each item in the list is a GByteArray which contains the complete

Packit ae235b
subject DN of the certificate authority.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

conn

Packit ae235b

the GTlsClientConnection

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Returns

Packit ae235b

the list of

Packit ae235b
CA DNs. You should unref each element with g_byte_array_unref() and then
Packit ae235b
the free the list with g_list_free(). 

Packit ae235b

[element-type GByteArray][transfer full]

Packit ae235b
Packit ae235b

Since: 2.28

Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_tls_client_connection_copy_session_state ()

Packit ae235b
void
Packit ae235b
g_tls_client_connection_copy_session_state
Packit ae235b
                               (GTlsClientConnection *conn,
Packit ae235b
                                GTlsClientConnection *source);
Packit ae235b

Copies session state from one connection to another. This is

Packit ae235b
not normally needed, but may be used when the same session
Packit ae235b
needs to be used between different endpoints as is required
Packit ae235b
by some protocols such as FTP over TLS. source
Packit ae235b
 should have
Packit ae235b
already completed a handshake, and conn
Packit ae235b
 should not have
Packit ae235b
completed a handshake.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

conn

Packit ae235b

a GTlsClientConnection

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

source

Packit ae235b

a GTlsClientConnection

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Since: 2.46

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Types and Values

Packit ae235b
Packit ae235b

GTlsClientConnection

Packit ae235b
typedef struct _GTlsClientConnection GTlsClientConnection;
Packit ae235b

Abstract base class for the backend-specific client connection

Packit ae235b
type.

Packit ae235b

Since: 2.28

Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

struct GTlsClientConnectionInterface

Packit ae235b
struct GTlsClientConnectionInterface {
Packit ae235b
  GTypeInterface g_iface;
Packit ae235b
Packit ae235b
  void     ( *copy_session_state )     (GTlsClientConnection       *conn,
Packit ae235b
                                        GTlsClientConnection       *source);
Packit ae235b
};
Packit ae235b
Packit ae235b

vtable for a GTlsClientConnection implementation.

Packit ae235b
Packit ae235b

Members

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

copy_session_state ()

Packit ae235b

Copies session state from one GTlsClientConnection to another.

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Since: 2.26

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Property Details

Packit ae235b
Packit ae235b

The “accepted-cas” property

Packit ae235b
  “accepted-cas”             gpointer
Packit ae235b

A list of the distinguished names of the Certificate Authorities

Packit ae235b
that the server will accept client certificates signed by. If the
Packit ae235b
server requests a client certificate during the handshake, then
Packit ae235b
this property will be set after the handshake completes.

Packit ae235b

Each item in the list is a GByteArray which contains the complete

Packit ae235b
subject DN of the certificate authority.

Packit ae235b

[element-type GLib.ByteArray]

Packit ae235b

Flags: Read

Packit ae235b

Since: 2.28

Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

The “server-identity” property

Packit ae235b
  “server-identity”          GSocketConnectable *
Packit ae235b

A GSocketConnectable describing the identity of the server that

Packit ae235b
is expected on the other end of the connection.

Packit ae235b

If the G_TLS_CERTIFICATE_BAD_IDENTITY flag is set in

Packit ae235b
“validation-flags”, this object will be used
Packit ae235b
to determine the expected identify of the remote end of the
Packit ae235b
connection; if “server-identity” is not set,
Packit ae235b
or does not match the identity presented by the server, then the
Packit ae235b
G_TLS_CERTIFICATE_BAD_IDENTITY validation will fail.

Packit ae235b

In addition to its use in verifying the server certificate,

Packit ae235b
this is also used to give a hint to the server about what
Packit ae235b
certificate we expect, which is useful for servers that serve
Packit ae235b
virtual hosts.

Packit ae235b

Flags: Read / Write / Construct

Packit ae235b

Since: 2.28

Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

The “use-ssl3” property

Packit ae235b
  “use-ssl3”                 gboolean
Packit ae235b

If TRUE, forces the connection to use a fallback version of TLS

Packit ae235b
or SSL, rather than trying to negotiate the best version of TLS
Packit ae235b
to use. This can be used when talking to servers that don't
Packit ae235b
implement version negotiation correctly and therefore refuse to
Packit ae235b
handshake at all with a modern TLS handshake.

Packit ae235b

Despite the property name, the fallback version is usually not

Packit ae235b
SSL 3.0, because SSL 3.0 is generally disabled by the GTlsBackend.
Packit ae235b
GTlsClientConnection will use the next-highest available version
Packit ae235b
as the fallback version.

Packit ae235b
Packit ae235b

GTlsClientConnection:use-ssl3 has been deprecated since version 2.56 and should not be used in newly-written code.

Packit ae235b

SSL 3.0 is insecure, and this property does not

Packit ae235b
generally enable or disable it, despite its name.

Packit ae235b
Packit ae235b

Flags: Read / Write / Construct

Packit ae235b

Default value: FALSE

Packit ae235b

Since: 2.28

Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

The “validation-flags” property

Packit ae235b
  “validation-flags”         GTlsCertificateFlags
Packit ae235b

What steps to perform when validating a certificate received from

Packit ae235b
a server. Server certificates that fail to validate in all of the
Packit ae235b
ways indicated here will be rejected unless the application
Packit ae235b
overrides the default via “accept-certificate”.

Packit ae235b

Flags: Read / Write / Construct

Packit ae235b

Default value: G_TLS_CERTIFICATE_UNKNOWN_CA | G_TLS_CERTIFICATE_BAD_IDENTITY | G_TLS_CERTIFICATE_NOT_ACTIVATED | G_TLS_CERTIFICATE_EXPIRED | G_TLS_CERTIFICATE_REVOKED | G_TLS_CERTIFICATE_INSECURE | G_TLS_CERTIFICATE_GENERIC_ERROR

Packit ae235b

Since: 2.28

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Generated by GTK-Doc V1.27
Packit ae235b
</body>
Packit ae235b
</html>