summaryrefslogtreecommitdiff
path: root/src/util.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-01-03 20:41:32 +0000
committerCarl Hetherington <cth@carlh.net>2013-01-03 20:41:32 +0000
commit50b5f8f9df0439d2d8fa9004e0b4af2f3e1eb44c (patch)
tree7fd862d261d406a7f93b8531b01b892feb309c8a /src/util.cc
parentaef58f7a1caf6a67c2c0b12ba3a6bc632d890f4e (diff)
Sort-of generates a signed CPL.
Diffstat (limited to 'src/util.cc')
-rw-r--r--src/util.cc26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/util.cc b/src/util.cc
index 2b3a6c8d..323fb1e4 100644
--- a/src/util.cc
+++ b/src/util.cc
@@ -27,6 +27,9 @@
#include <iomanip>
#include <boost/filesystem.hpp>
#include <openssl/sha.h>
+#include <xmlsec/xmldsig.h>
+#include <xmlsec/dl.h>
+#include <xmlsec/app.h>
#include "KM_util.h"
#include "KM_fileio.h"
#include "AS_DCP.h"
@@ -37,6 +40,7 @@
#include "lut.h"
using std::string;
+using std::cout;
using std::stringstream;
using std::min;
using std::max;
@@ -267,3 +271,25 @@ libdcp::empty_or_white_space (string s)
return true;
}
+
+void
+libdcp::init ()
+{
+ if (xmlSecInit() < 0) {
+ throw MiscError ("could not initialise xmlsec");
+ }
+
+#ifdef XMLSEC_CRYPTO_DYNAMIC_LOADING
+ if (xmlSecCryptoDLLoadLibrary (BAD_CAST XMLSEC_CRYPTO) < 0) {
+ throw MiscError ("unable to load default xmlsec-crypto library");
+ }
+#endif
+
+ if (xmlSecCryptoAppInit (0) < 0) {
+ throw MiscError ("could not initialise crypto library");
+ }
+
+ if (xmlSecCryptoInit() < 0) {
+ throw MiscError ("could not initialise xmlsec-crypto");
+ }
+}