- err = gnutls_certificate_set_x509_key_file(x509_cred, cert_file, Conf_SSLOptions.KeyFile, GNUTLS_X509_FMT_PEM);
- if (err < 0) {
- Log(LOG_ERR,
- "Failed to set certificate key file (cert %s, key %s): %s",
- cert_file,
- Conf_SSLOptions.KeyFile ? Conf_SSLOptions.KeyFile : "(NULL)",
- gnutls_strerror(err));
- return false;
+
+ cert_file = Conf_SSLOptions.CertFile ?
+ Conf_SSLOptions.CertFile : Conf_SSLOptions.KeyFile;
+ if (Conf_SSLOptions.KeyFile) {
+ err = gnutls_certificate_set_x509_key_file(x509_cred, cert_file,
+ Conf_SSLOptions.KeyFile,
+ GNUTLS_X509_FMT_PEM);
+ if (err < 0) {
+ Log(LOG_ERR,
+ "Failed to set certificate key file (cert %s, key %s): %s",
+ cert_file,
+ Conf_SSLOptions.KeyFile ? Conf_SSLOptions.KeyFile : "(NULL)",
+ gnutls_strerror(err));
+ return false;
+ }