Gio.TlsConnection.prototype.set_certificate

function set_certificate(certificate: Gio.TlsCertificate): void {
    // Gjs wrapper for g_tls_connection_set_certificate()
}
  

This sets the certificate that conn will present to its peer during the TLS handshake. For a Gio.TlsServerConnection, it is mandatory to set this, and that will normally be done at construct time.

For a Gio.TlsClientConnection, this is optional. If a handshake fails with Gio.TlsError.certificate_required, that means that the server requires a certificate, and if you try connecting again, you should call this method first. You can call Gio.TlsClientConnection.prototype.get_accepted_cas on the failed connection to get a list of Certificate Authorities that the server will accept certificates from.

(It is also possible that a server will allow the connection with or without a certificate; in that case, if you don't provide a certificate, you can tell that the server requested one by the fact that Gio.TlsClientConnection.prototype.get_accepted_cas will return non-null.)

Since 2.28

certificate

the certificate to use for conn