DtlsConnection.setCertificate

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

For a #GDtlsClientConnection, this is optional. If a handshake fails with gio.types.TlsError.CertificateRequired, that means that the server requires a certificate, and if you try connecting again, you should call this method first. You can call gio.dtls_client_connection.DtlsClientConnection.getAcceptedCas 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.dtls_client_connection.DtlsClientConnection.getAcceptedCas will return non-null.)

interface DtlsConnection
void
setCertificate

Parameters

certificate gio.tls_certificate.TlsCertificate

the certificate to use for conn