Need working ways to specify the key, cert, and chain.

This commit is contained in:
JoelKatz
2012-12-06 19:19:53 -08:00
parent dbb70e2bf9
commit 670763d321
3 changed files with 8 additions and 1 deletions

View File

@@ -41,6 +41,8 @@
#define SECTION_WEBSOCKET_PORT "websocket_port"
#define SECTION_WEBSOCKET_SECURE "websocket_secure"
#define SECTION_WEBSOCKET_SSL_CERT "websocket_ssl_cert"
#define SECTION_WEBSOCKET_SSL_CHAIN "websocket_ssl_chain"
#define SECTION_WEBSOCKET_SSL_KEY "websocket_ssl_key"
#define SECTION_VALIDATORS "validators"
#define SECTION_VALIDATORS_SITE "validators_site"
@@ -263,6 +265,8 @@ void Config::load()
WEBSOCKET_SECURE = boost::lexical_cast<bool>(strTemp);
sectionSingleB(secConfig, SECTION_WEBSOCKET_SSL_CERT, WEBSOCKET_SSL_CERT);
sectionSingleB(secConfig, SECTION_WEBSOCKET_SSL_CHAIN, WEBSOCKET_SSL_CHAIN);
sectionSingleB(secConfig, SECTION_WEBSOCKET_SSL_KEY, WEBSOCKET_SSL_KEY);
if (sectionSingleB(secConfig, SECTION_VALIDATION_SEED, strTemp))

View File

@@ -94,6 +94,7 @@ public:
bool WEBSOCKET_SECURE;
std::string WEBSOCKET_SSL_CERT;
std::string WEBSOCKET_SSL_CHAIN;
std::string WEBSOCKET_SSL_KEY;
// RPC parameters
std::string RPC_IP;

View File

@@ -138,7 +138,9 @@ public:
boost::asio::ssl::context::single_dh_use);
// context->set_password_callback(boost::bind(&type::get_password, this));
if (!theConfig.WEBSOCKET_SSL_CERT.empty())
context->use_private_key_file(theConfig.WEBSOCKET_SSL_CERT, boost::asio::ssl::context::pem);
context->use_certificate_file(theConfig.WEBSOCKET_SSL_CERT, boost::asio::ssl::context::pem);
if (!theConfig.WEBSOCKET_SSL_KEY.empty())
context->use_private_key_file(theConfig.WEBSOCKET_SSL_KEY, boost::asio::ssl::context::pem);
if (!theConfig.WEBSOCKET_SSL_CHAIN.empty())
context->use_certificate_chain_file(theConfig.WEBSOCKET_SSL_CHAIN);
//context->use_tmp_dh_file("../../src/ssl/dh512.pem");