diff options
| author | Carl Hetherington <cth@carlh.net> | 2013-10-11 17:59:12 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2013-10-11 17:59:12 +0100 |
| commit | 53f24c9f2c0c9b3d2a835e11def36c31a4072759 (patch) | |
| tree | a676fe5edabaf14f14bd3baee3fae27a8fddcf33 /src/lib | |
| parent | 27408eba8fdbd7498399f41ba89ae77de8aee10c (diff) | |
Remake the certificate chain if any part of it is missing.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/util.cc | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/src/lib/util.cc b/src/lib/util.cc index e0495f18b..badbda4ab 100644 --- a/src/lib/util.cc +++ b/src/lib/util.cc @@ -824,10 +824,28 @@ shared_ptr<const libdcp::Signer> make_signer () { boost::filesystem::path const sd = Config::instance()->signer_chain_directory (); - if (boost::filesystem::is_empty (sd)) { - libdcp::make_signer_chain (sd, openssl_path ()); - } + /* Remake the chain if any of it is missing */ + + list<boost::filesystem::path> files; + files.push_back ("ca.self-signed.pem"); + files.push_back ("intermediate.signed.pem"); + files.push_back ("leaf.signed.pem"); + files.push_back ("leaf.key"); + + list<boost::filesystem::path>::const_iterator i = files.begin(); + while (i != files.end()) { + boost::filesystem::path p (sd); + sd /= *i; + if (!boost::filesystem::exists (sd)) { + boost::filesystem::remove_all (sd); + libdcp::make_signer_chain (sd, openssl_path ()); + break; + } + + ++i; + } + libdcp::CertificateChain chain; { |
