summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2014-08-25 12:42:22 +0100
committerCarl Hetherington <cth@carlh.net>2014-08-25 12:42:22 +0100
commit6f31627406a63d09c3ec33494a54158095663111 (patch)
tree8b69382e8eccbe80654e7ca7d89bebb3b68cba77 /src/lib
parente69d12427d19a6d1255c2275478a9574a9f7972a (diff)
Also create decryption certs if there is no config file.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/config.cc16
-rw-r--r--src/lib/config.h1
2 files changed, 13 insertions, 4 deletions
diff --git a/src/lib/config.cc b/src/lib/config.cc
index 576b02fdc..d20536f14 100644
--- a/src/lib/config.cc
+++ b/src/lib/config.cc
@@ -95,6 +95,8 @@ Config::read ()
if (!boost::filesystem::exists (file (false))) {
/* Make a new set of signing certificates and key */
_signer.reset (new dcp::Signer (openssl_path ()));
+ /* And decryption keys */
+ make_decryption_keys ();
return;
}
@@ -238,13 +240,19 @@ Config::read ()
if (!f.optional_string_child ("DecryptionCertificate") || !f.optional_string_child ("DecryptionPrivateKey")) {
/* Generate our own decryption certificate and key if either is not present in config */
- boost::filesystem::path p = dcp::make_certificate_chain (openssl_path ());
- _decryption_certificate = dcp::Certificate (dcp::file_to_string (p / "leaf.signed.pem"));
- _decryption_private_key = dcp::file_to_string (p / "leaf.key");
- boost::filesystem::remove_all (p);
+ make_decryption_keys ();
}
}
+void
+Config::make_decryption_keys ()
+{
+ boost::filesystem::path p = dcp::make_certificate_chain (openssl_path ());
+ _decryption_certificate = dcp::Certificate (dcp::file_to_string (p / "leaf.signed.pem"));
+ _decryption_private_key = dcp::file_to_string (p / "leaf.key");
+ boost::filesystem::remove_all (p);
+}
+
/** @return Filename to write configuration to */
boost::filesystem::path
Config::file (bool old) const
diff --git a/src/lib/config.h b/src/lib/config.h
index 310d3c6f5..3cfaa1200 100644
--- a/src/lib/config.h
+++ b/src/lib/config.h
@@ -426,6 +426,7 @@ private:
boost::filesystem::path file (bool) const;
void read ();
void write () const;
+ void make_decryption_keys ();
/** number of threads to use for J2K encoding on the local machine */
int _num_local_encoding_threads;