diff options
Diffstat (limited to 'src/certificate_chain.cc')
| -rw-r--r-- | src/certificate_chain.cc | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/certificate_chain.cc b/src/certificate_chain.cc index df68cb9f..ac01d860 100644 --- a/src/certificate_chain.cc +++ b/src/certificate_chain.cc @@ -55,6 +55,7 @@ #include <boost/algorithm/string.hpp> #include <boost/foreach.hpp> #include <fstream> +#include <iostream> using std::string; using std::ofstream; @@ -312,6 +313,24 @@ CertificateChain::CertificateChain ( boost::filesystem::remove_all (directory); } +CertificateChain::CertificateChain (string s) +{ + while (true) { + try { + Certificate c; + s = c.read_string (s); + _certificates.push_back (c); + } catch (MiscError& e) { + /* Failed to read a certificate, just stop */ + break; + } + } + + if (!attempt_reorder ()) { + throw MiscError ("could not find certificate chain order"); + } +} + /** @return Root certificate */ Certificate CertificateChain::root () const |
