diff options
author | Mathieu Souchaud <[email protected]> | 2018-02-01 09:16:04 +0000 |
---|---|---|
committer | Mathieu Souchaud <[email protected]> | 2018-02-01 09:16:04 +0000 |
commit | 8ba88feb44a972e14499741bfade75d117552736 (patch) | |
tree | ce53797c2bc7d10d8322197fa0b8346bb6348295 /src/lib | |
parent | 439d2ead033142365f092c7882bad31e4257ed09 (diff) |
Load every certificates of files found.
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/x509/certstor.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/lib/x509/certstor.cpp b/src/lib/x509/certstor.cpp index 23e8185c4..904e322b1 100644 --- a/src/lib/x509/certstor.cpp +++ b/src/lib/x509/certstor.cpp @@ -9,6 +9,7 @@ #include <botan/certstor.h> #include <botan/internal/filesystem.h> #include <botan/hash.h> +#include <botan/data_src.h> namespace Botan { @@ -184,8 +185,20 @@ Certificate_Store_In_Memory::Certificate_Store_In_Memory(const std::string& dir) for(auto&& cert_file : maybe_certs) { try - { - m_certs.push_back(std::make_shared<X509_Certificate>(cert_file)); + { + DataSource_Stream src(cert_file, true); + while(!src.end_of_data()) + { + try + { + m_certs.push_back(std::make_shared<X509_Certificate>(src)); + } + catch(std::exception&) + { + // stop searching for other certificate at first exception + break; + } + } } catch(std::exception&) { |