mirror of
https://github.com/wownero/lwsf-wow.git
synced 2026-10-17 07:21:28 +02:00
Add support for providing CA file for SSL verification
This commit is contained in:
@@ -814,6 +814,27 @@ namespace lwsf { namespace internal
|
|||||||
else
|
else
|
||||||
url.port = 80;
|
url.port = 80;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Configure SSL certificate verification
|
||||||
|
if (options.support != epee::net_utils::ssl_support_t::e_ssl_support_disabled)
|
||||||
|
{
|
||||||
|
bool ca_file_valid = !ca_file_path_.empty() && std::filesystem::exists(ca_file_path_);
|
||||||
|
|
||||||
|
if (ca_file_valid) {
|
||||||
|
try {
|
||||||
|
options = epee::net_utils::ssl_options_t(
|
||||||
|
std::vector<std::vector<std::uint8_t>>{},
|
||||||
|
ca_file_path_
|
||||||
|
);
|
||||||
|
options.verification = epee::net_utils::ssl_verification_t::user_ca;
|
||||||
|
} catch (const std::exception& e) {
|
||||||
|
options.verification = epee::net_utils::ssl_verification_t::system_ca;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
options.verification = epee::net_utils::ssl_verification_t::system_ca;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
data_->client.set_server(std::move(url.host), std::to_string(url.port), std::move(login), std::move(options));
|
data_->client.set_server(std::move(url.host), std::to_string(url.port), std::move(login), std::move(options));
|
||||||
}
|
}
|
||||||
catch (const std::exception& e)
|
catch (const std::exception& e)
|
||||||
@@ -886,6 +907,11 @@ namespace lwsf { namespace internal
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wallet::setCaFilePath(const std::string &path)
|
||||||
|
{
|
||||||
|
ca_file_path_ = path;
|
||||||
|
}
|
||||||
|
|
||||||
uint64_t wallet::balance(const uint32_t accountIndex) const
|
uint64_t wallet::balance(const uint32_t accountIndex) const
|
||||||
{
|
{
|
||||||
const boost::lock_guard<boost::mutex> lock{data_->sync};
|
const boost::lock_guard<boost::mutex> lock{data_->sync};
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ namespace internal
|
|||||||
const std::string filename_;
|
const std::string filename_;
|
||||||
std::string password_;
|
std::string password_;
|
||||||
std::string language_;
|
std::string language_;
|
||||||
|
std::string ca_file_path_;
|
||||||
std::deque<std::function<std::error_code()>> work_queue_;
|
std::deque<std::function<std::error_code()>> work_queue_;
|
||||||
mutable std::string exception_error_;
|
mutable std::string exception_error_;
|
||||||
mutable std::error_code error_;
|
mutable std::error_code error_;
|
||||||
@@ -267,6 +268,7 @@ namespace internal
|
|||||||
virtual void setTrustedDaemon(bool) override {}
|
virtual void setTrustedDaemon(bool) override {}
|
||||||
virtual bool trustedDaemon() const override { return true; }
|
virtual bool trustedDaemon() const override { return true; }
|
||||||
virtual bool setProxy(const std::string &address) override;
|
virtual bool setProxy(const std::string &address) override;
|
||||||
|
void setCaFilePath(const std::string &path);
|
||||||
virtual uint64_t balance(uint32_t accountIndex = 0) const override;
|
virtual uint64_t balance(uint32_t accountIndex = 0) const override;
|
||||||
virtual uint64_t unlockedBalance(uint32_t accountIndex = 0) const override;
|
virtual uint64_t unlockedBalance(uint32_t accountIndex = 0) const override;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user