return "/etc/umurmur/private_key.key";
}
break;
+ case CAPATH:
+ setting = config_lookup(&configuration, "ca_path");
+ if (!setting)
+ return NULL;
+ else {
+ if ((strsetting = config_setting_get_string(setting)) != NULL)
+ return strsetting;
+ else
+ return NULL;
+ }
+ break;
case PASSPHRASE:
setting = config_lookup(&configuration, "password");
if (!setting)
FILE *fp;
X509 *x509;
- /* open the private key file */
+ /* open the certificate file */
fp = fopen(certfile, "r");
if (fp == NULL) {
Log_warn("Unable to open the X509 file %s for reading.", certfile);
}
static void SSL_initializeCert() {
+
char *crt, *key, *pass;
crt = (char *)getStrConf(CERTIFICATE);
pkey = EVP_PKEY_new();
EVP_PKEY_assign_RSA(pkey, rsa);
}
+
#if 0
/* Later ... */
char *cipherstring, tempstring[128];
SSL_library_init();
- OpenSSL_add_all_algorithms(); /* load & register all cryptos, etc. */
- SSL_load_error_strings(); /* load all error messages */
- ERR_load_crypto_strings(); /* load all error messages */
- method = SSLv23_server_method(); /* create new server-method instance */
- context = SSL_CTX_new(method); /* create new context from method */
- if (context == NULL)
- {
- ERR_print_errors_fp(stderr);
- abort();
- }
+ OpenSSL_add_all_algorithms(); /* load & register all cryptos, etc. */
+ SSL_load_error_strings(); /* load all error messages */
+ ERR_load_crypto_strings(); /* load all error messages */
+ method = SSLv23_server_method(); /* create new server-method instance */
+ context = SSL_CTX_new(method); /* create new context from method */
+ if (context == NULL)
+ {
+ ERR_print_errors_fp(stderr);
+ abort();
+ }
+
+ char* sslCAPath = getStrConf(CAPATH);
+ if(sslCAPath != NULL)
+ {
+ SSL_CTX_load_verify_locations(context, NULL, sslCAPath);
+ }
+
SSL_initializeCert();
if (SSL_CTX_use_certificate(context, x509) <= 0)
Log_fatal("Failed to initialize cert");
ERR_print_errors_fp(stderr);
Log_fatal("Failed to initialize private key");
}
-
+
/* Set cipher list */
ssl = SSL_new(context);
cipherlist = (STACK_OF(SSL_CIPHER) *) SSL_get_ciphers(ssl);