|
|
@ -28,6 +28,7 @@
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
|
|
|
|
// Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <boost/preprocessor/stringize.hpp>
|
|
|
|
#include "include_base_utils.h"
|
|
|
|
#include "include_base_utils.h"
|
|
|
|
#include "string_tools.h"
|
|
|
|
#include "string_tools.h"
|
|
|
|
using namespace epee;
|
|
|
|
using namespace epee;
|
|
|
@ -159,6 +160,14 @@ namespace cryptonote
|
|
|
|
const std::vector<std::string> ssl_allowed_fingerprint_strings = command_line::get_arg(vm, arg_rpc_ssl_allowed_fingerprints);
|
|
|
|
const std::vector<std::string> ssl_allowed_fingerprint_strings = command_line::get_arg(vm, arg_rpc_ssl_allowed_fingerprints);
|
|
|
|
std::vector<std::vector<uint8_t>> ssl_allowed_fingerprints{ ssl_allowed_fingerprint_strings.size() };
|
|
|
|
std::vector<std::vector<uint8_t>> ssl_allowed_fingerprints{ ssl_allowed_fingerprint_strings.size() };
|
|
|
|
std::transform(ssl_allowed_fingerprint_strings.begin(), ssl_allowed_fingerprint_strings.end(), ssl_allowed_fingerprints.begin(), epee::from_hex::vector);
|
|
|
|
std::transform(ssl_allowed_fingerprint_strings.begin(), ssl_allowed_fingerprint_strings.end(), ssl_allowed_fingerprints.begin(), epee::from_hex::vector);
|
|
|
|
|
|
|
|
for (const auto &fpr: ssl_allowed_fingerprints)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (fpr.size() != SSL_FINGERPRINT_SIZE)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
MERROR("SHA-256 fingerprint should be " BOOST_PP_STRINGIZE(SSL_FINGERPRINT_SIZE) " bytes long.");
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!ssl_ca_path.empty() || !ssl_allowed_fingerprints.empty())
|
|
|
|
if (!ssl_ca_path.empty() || !ssl_allowed_fingerprints.empty())
|
|
|
|
ssl_options = epee::net_utils::ssl_options_t{std::move(ssl_allowed_fingerprints), std::move(ssl_ca_path)};
|
|
|
|
ssl_options = epee::net_utils::ssl_options_t{std::move(ssl_allowed_fingerprints), std::move(ssl_ca_path)};
|
|
|
|