aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/cert/x509/certstor.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2015-02-21 14:14:45 +0000
committerlloyd <[email protected]>2015-02-21 14:14:45 +0000
commit5ef7108d620a00ce5b2f6997c8b6ffc0708467d6 (patch)
tree670771c55dfb1e77e0783cd791355327ecdf1ef6 /src/lib/cert/x509/certstor.cpp
parentee2ac0c46d0c76e04b0fa68f9bb73825b60a4b09 (diff)
Hide all uses of boost filesystem in fs.cpp. Use readdir as an
alternate implementation for Unix and add some feature checks so a boost-free build of the tests and command line are possible again.
Diffstat (limited to 'src/lib/cert/x509/certstor.cpp')
-rw-r--r--src/lib/cert/x509/certstor.cpp25
1 files changed, 7 insertions, 18 deletions
diff --git a/src/lib/cert/x509/certstor.cpp b/src/lib/cert/x509/certstor.cpp
index cbb0fd670..d7e6f0a65 100644
--- a/src/lib/cert/x509/certstor.cpp
+++ b/src/lib/cert/x509/certstor.cpp
@@ -6,10 +6,7 @@
*/
#include <botan/certstor.h>
-
-#if defined(BOTAN_HAS_BOOST_FILESYSTEM)
-#include <boost/filesystem.hpp>
-#endif
+#include <botan/fs.h>
namespace Botan {
@@ -116,25 +113,17 @@ Certificate_Store_In_Memory::Certificate_Store_In_Memory(const std::string& dir)
if(dir == "")
return;
-#if defined(BOTAN_HAS_BOOST_FILESYSTEM)
- boost::filesystem::recursive_directory_iterator i(dir);
- boost::filesystem::recursive_directory_iterator end;
-
- while(i != end)
+ std::vector<std::string> maybe_certs = list_all_readable_files_in_or_under(dir);
+ for(auto&& cert_file : maybe_certs)
{
- auto path = i->path();
- ++i;
-
try
{
- if(boost::filesystem::is_regular_file(path))
- m_certs.push_back(X509_Certificate(path.string()));
+ m_certs.push_back(X509_Certificate(cert_file));
+ }
+ catch(std::exception&)
+ {
}
- catch(...) {}
}
-#else
- throw std::runtime_error("Certificate_Store_In_Memory: FS access disabled");
-#endif
}
const X509_Certificate*