Merge pull request #1 from MAGICGrants/user-ca-ssl-verification

Add support for providing CA file for SSL verification
This commit is contained in:
Lee *!* Clagett
2025-11-25 15:07:11 -05:00
committed by GitHub
2 changed files with 28 additions and 0 deletions
+26
View File
@@ -814,6 +814,27 @@ namespace lwsf { namespace internal
else
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));
}
catch (const std::exception& e)
@@ -886,6 +907,11 @@ namespace lwsf { namespace internal
return true;
}
void wallet::setCaFilePath(const std::string &path)
{
ca_file_path_ = path;
}
uint64_t wallet::balance(const uint32_t accountIndex) const
{
const boost::lock_guard<boost::mutex> lock{data_->sync};
+2
View File
@@ -62,6 +62,7 @@ namespace internal
const std::string filename_;
std::string password_;
std::string language_;
std::string ca_file_path_;
std::deque<std::function<std::error_code()>> work_queue_;
mutable std::string exception_error_;
mutable std::error_code error_;
@@ -267,6 +268,7 @@ namespace internal
virtual void setTrustedDaemon(bool) override {}
virtual bool trustedDaemon() const override { return true; }
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 unlockedBalance(uint32_t accountIndex = 0) const override;