aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2018-03-24 05:41:26 -0400
committerJack Lloyd <[email protected]>2018-03-24 05:41:26 -0400
commit8cbcc468ee8a1767f091b7aa73ab3a3b08bde253 (patch)
tree0af62dcb86b46bb390397c1f8e411ed2688d1229
parent66cac5ea380133c38285d83b25f8010ed3cf8314 (diff)
Extend Certificate_Store_In_Memory to load just a single cert from file
-rw-r--r--src/lib/x509/certstor.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/lib/x509/certstor.cpp b/src/lib/x509/certstor.cpp
index 904e322b1..2356a70c6 100644
--- a/src/lib/x509/certstor.cpp
+++ b/src/lib/x509/certstor.cpp
@@ -182,19 +182,25 @@ Certificate_Store_In_Memory::Certificate_Store_In_Memory(const std::string& dir)
return;
std::vector<std::string> maybe_certs = get_files_recursive(dir);
+
+ if(maybe_certs.empty())
+ {
+ maybe_certs.push_back(dir);
+ }
+
for(auto&& cert_file : maybe_certs)
{
try
- {
+ {
DataSource_Stream src(cert_file, true);
while(!src.end_of_data())
{
try
{
- m_certs.push_back(std::make_shared<X509_Certificate>(src));
+ m_certs.push_back(std::make_shared<X509_Certificate>(src));
}
catch(std::exception&)
- {
+ {
// stop searching for other certificate at first exception
break;
}