TlsConnection

#GTlsConnection is the base TLS connection class type, which wraps a #GIOStream and provides TLS encryption on top of it. Its subclasses, #GTlsClientConnection and #GTlsServerConnection, implement client-side and server-side TLS, respectively.

Constructors

this
this(GTlsConnection* gTlsConnection, bool ownedRef)

Sets our main struct and passes it to the parent class.

Members

Functions

addOnAcceptCertificate
void addOnAcceptCertificate(bool delegate(TlsCertificate, GTlsCertificateFlags, TlsConnection) dlg, ConnectFlags connectFlags)

Emitted during the TLS handshake after the peer certificate has been received. You can examine @peer_cert's certification path by calling g_tls_certificate_get_issuer() on it.

emitAcceptCertificate
bool emitAcceptCertificate(TlsCertificate peerCert, GTlsCertificateFlags errors)

Used by #GTlsConnection implementations to emit the #GTlsConnection::accept-certificate signal.

getCertificate
TlsCertificate getCertificate()

Gets @conn's certificate, as set by g_tls_connection_set_certificate().

getDatabase
TlsDatabase getDatabase()

Gets the certificate database that @conn uses to verify peer certificates. See g_tls_connection_set_database().

getInteraction
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 connection.

getPeerCertificate
TlsCertificate getPeerCertificate()

Gets @conn's peer's certificate after the handshake has completed. (It is not set during the emission of #GTlsConnection::accept-certificate.)

getPeerCertificateErrors
GTlsCertificateFlags getPeerCertificateErrors()

Gets the errors associated with validating @conn's peer's certificate, after the handshake has completed. (It is not set during the emission of #GTlsConnection::accept-certificate.)

getRehandshakeMode
GTlsRehandshakeMode getRehandshakeMode()

Gets @conn rehandshaking mode. See g_tls_connection_set_rehandshake_mode() for details.

getRequireCloseNotify
bool getRequireCloseNotify()

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.

getStruct
void* getStruct()

the main Gtk struct as a void*

getTlsConnectionStruct
GTlsConnection* getTlsConnectionStruct()

Get the main Gtk struct

getUseSystemCertdb
bool getUseSystemCertdb()

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

handshake
bool handshake(Cancellable cancellable)

Attempts a TLS handshake on @conn.

handshakeAsync
void handshakeAsync(int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)

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

handshakeFinish
bool handshakeFinish(AsyncResultIF result)

Finish an asynchronous TLS handshake operation. See g_tls_connection_handshake() for more information.

setCertificate
void setCertificate(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.

setDatabase
void setDatabase(TlsDatabase database)

Sets the certificate database that is used to verify peer certificates. This is set to the default database by default. See g_tls_backend_get_default_database(). If set to %NULL, then peer certificate validation will always set the %G_TLS_CERTIFICATE_UNKNOWN_CA error (meaning #GTlsConnection::accept-certificate will always be emitted on client-side connections, unless that bit is not set in #GTlsClientConnection:validation-flags).

setInteraction
void setInteraction(TlsInteraction interaction)

Set the object that will be used to interact with the user. It will be used for things like prompting the user for passwords.

setRehandshakeMode
void setRehandshakeMode(GTlsRehandshakeMode mode)

Sets how @conn behaves with respect to rehandshaking requests.

setRequireCloseNotify
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 peer before the connection is closed, and will return a %G_TLS_ERROR_EOF error if the connection is closed without proper notification (since this may indicate a network error, or man-in-the-middle attack).

setStruct
void setStruct(GObject* obj)
Undocumented in source. Be warned that the author may not have intended to support it.
setUseSystemCertdb
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 %G_TLS_CERTIFICATE_UNKNOWN_CA error (meaning #GTlsConnection::accept-certificate will always be emitted on client-side connections, unless that bit is not set in #GTlsClientConnection:validation-flags).

Static functions

callBackAcceptCertificate
int callBackAcceptCertificate(GTlsConnection* tlsconnectionStruct, GTlsCertificate* peerCert, GTlsCertificateFlags errors, TlsConnection _tlsconnection)
Undocumented in source. Be warned that the author may not have intended to support it.
getType
GType getType()

Variables

connectedSignals
int[string] connectedSignals;
Undocumented in source.
gTlsConnection
GTlsConnection* gTlsConnection;

the main Gtk struct

onAcceptCertificateListeners
bool delegate(TlsCertificate, GTlsCertificateFlags, TlsConnection)[] onAcceptCertificateListeners;
Undocumented in source.

Inherited Members

From IOStream

gIOStream
GIOStream* gIOStream;

the main Gtk struct

getIOStreamStruct
GIOStream* getIOStreamStruct()

Get the main Gtk struct

getStruct
void* getStruct()

the main Gtk struct as a void*

setStruct
void setStruct(GObject* obj)
Undocumented in source. Be warned that the author may not have intended to support it.
getType
GType getType()
spliceFinish
bool spliceFinish(AsyncResultIF result)

Finishes an asynchronous io stream splice operation.

clearPending
void clearPending()

Clears the pending flag on @stream.

close
bool close(Cancellable cancellable)

Closes the stream, releasing resources related to it. This will also close the individual input and output streams, if they are not already closed.

closeAsync
void closeAsync(int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)

Requests an asynchronous close of the stream, releasing resources related to it. When the operation is finished @callback will be called. You can then call g_io_stream_close_finish() to get the result of the operation.

closeFinish
bool closeFinish(AsyncResultIF result)

Closes a stream.

getInputStream
InputStream getInputStream()

Gets the input stream for this object. This is used for reading.

getOutputStream
OutputStream getOutputStream()

Gets the output stream for this object. This is used for writing.

hasPending
bool hasPending()

Checks if a stream has pending actions.

isClosed
bool isClosed()

Checks if a stream is closed.

setPending
bool setPending()

Sets @stream to have actions pending. If the pending flag is already set or @stream is closed, it will return %FALSE and set @error.

spliceAsync
void spliceAsync(IOStream stream2, GIOStreamSpliceFlags flags, int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)

Asyncronously splice the output stream of @stream1 to the input stream of @stream2, and splice the output stream of @stream2 to the input stream of @stream1.

Meta

Since

2.28