aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2018-02-02 11:39:24 -0500
committerJack Lloyd <[email protected]>2018-02-02 11:39:24 -0500
commitda288ccb4bb1bb6a95fdbf59bc0f31266a1e2bef (patch)
tree92799971e7aeb8836ae6b57f5c4ad18d1bdbf247 /src/lib
parentdeeca72a3e5f875c87601e0da673288a798c55d5 (diff)
parente9b1771b72a6b405e270dd21751b30e5e9b495f4 (diff)
Merge GH #1436 In Certificate_Store load multiple certs from file
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/x509/certstor.cpp17
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&)
{