3 #include <gnutls/gnutls.h>
5 static gnutls_certificate_credentials_t cert_cred;
12 err = gnutls_certificate_allocate_credentials(&cert_cred);
14 die("Unable to allocate credentials: %s", gnutls_strerror(err));
15 err = gnutls_certificate_set_x509_trust_file(cert_cred, "ca-cert.pem", GNUTLS_X509_FMT_PEM);
17 die("No CA certificate found");
19 die("Unable to load X509 trust file: %s", gnutls_strerror(err));
20 err = gnutls_certificate_set_x509_key_file(cert_cred, "server-cert.pem", "server-key.pem", GNUTLS_X509_FMT_PEM);
22 die("Unable to load X509 key file: %s", gnutls_strerror(err));
24 gnutls_global_deinit();