summaryrefslogtreecommitdiff
path: root/src/lib/util.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-10-03 18:04:31 +0100
committerCarl Hetherington <cth@carlh.net>2013-10-03 18:04:31 +0100
commit568e553f506809e753c78a0e0cbad5906bc002b1 (patch)
tree4cd234309105ce1f9fc571148d984100738826e7 /src/lib/util.cc
parentc869563a1414c869ac15f8d590217a45c7739996 (diff)
KDM / libdcp API changes.
Diffstat (limited to 'src/lib/util.cc')
-rw-r--r--src/lib/util.cc37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/lib/util.cc b/src/lib/util.cc
index 6746b4773..ae3de2d6b 100644
--- a/src/lib/util.cc
+++ b/src/lib/util.cc
@@ -46,6 +46,8 @@
#include <magick/version.h>
#include <libdcp/version.h>
#include <libdcp/util.h>
+#include <libdcp/signer_chain.h>
+#include <libdcp/signer.h>
extern "C" {
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
@@ -816,3 +818,38 @@ tidy_for_filename (string f)
return t;
}
+
+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);
+ }
+
+ libdcp::CertificateChain chain;
+
+ {
+ boost::filesystem::path p (sd);
+ p /= "ca.self-signed.pem";
+ chain.add (shared_ptr<libdcp::Certificate> (new libdcp::Certificate (p)));
+ }
+
+ {
+ boost::filesystem::path p (sd);
+ p /= "intermediate.signed.pem";
+ chain.add (shared_ptr<libdcp::Certificate> (new libdcp::Certificate (p)));
+ }
+
+ {
+ boost::filesystem::path p (sd);
+ p /= "leaf.signed.pem";
+ chain.add (shared_ptr<libdcp::Certificate> (new libdcp::Certificate (p)));
+ }
+
+ boost::filesystem::path signer_key (sd);
+ signer_key /= "leaf.key";
+
+ return shared_ptr<const libdcp::Signer> (new libdcp::Signer (chain, signer_key));
+}
+