Everything TLS Related
libsoup comes with TLS support provided by glib-networking. This has multiple backends
including gnutls (default on all platforms), SChannel on Windows, or OpenSSL.
Accepting Invalid or Pinned Certificates
This makes use of the SoupMessage::accept-certificate signal.
Setting a Custom CA
message);
g_error_free (error);
return;
}
SoupSession *session = soup_session_new_with_options ("tls-database", tls_db, NULL);
g_object_unref (tls_db);
}]]>
Using Client Certificates
message);
g_error_free (error);
return 1;
}
SoupSession *session = soup_session_new ();
SoupMessage *msg = soup_message_new ("GET", "https://example.org");
/* We can set the certificate ahead of time if we already have one */
// soup_message_set_tls_client_certificate (msg, client_cert)
/* However we can also dynamically request one which is useful in
* applications that show a graphical prompt for example. */
g_signal_connect (msg, "request-certificate",
G_CALLBACK (on_request_certificate), client_cert);
// Send the message...
g_object_unref (msg);
g_object_unref (session);
g_object_unref (client_cert);
return 0;
}]]>