set_certificate


Description:

public void set_certificate (TlsCertificate certificate)

This sets the certificate that this will present to its peer during the TLS handshake.

For a TlsServerConnection, it is mandatory to set this, and that will normally be done at construct time.

For a TlsClientConnection, this is optional. If a handshake fails with g_tls_error_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 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 get_accepted_cas will return non- null.)

Parameters:

this

a TlsConnection

certificate

the certificate to use for this