summaryrefslogtreecommitdiff
path: root/src/signer.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2014-09-11 14:06:19 +0100
committerCarl Hetherington <cth@carlh.net>2014-09-11 14:06:19 +0100
commitf4e3b9c0b4027018c39b9085e080325c19ac9164 (patch)
treeec6319337e328d0a26fd7daddb004d411bf76e20 /src/signer.cc
parentf0da23525fd60c4c9f054e5d603adb1b7ec05d19 (diff)
Allow Signer and certificate chains to be made with specified organisation, common name etc.
Diffstat (limited to 'src/signer.cc')
-rw-r--r--src/signer.cc27
1 files changed, 25 insertions, 2 deletions
diff --git a/src/signer.cc b/src/signer.cc
index d048ca4c..67c8ac58 100644
--- a/src/signer.cc
+++ b/src/signer.cc
@@ -42,8 +42,32 @@ using namespace dcp;
Signer::Signer (boost::filesystem::path openssl)
{
- boost::filesystem::path directory = make_certificate_chain (openssl);
+ create (make_certificate_chain (openssl));
+}
+
+Signer::Signer (boost::filesystem::path openssl,
+ string organisation,
+ string organisational_unit,
+ string root_common_name,
+ string intermediate_common_name,
+ string leaf_common_name
+ )
+{
+ create (
+ make_certificate_chain (
+ openssl,
+ organisation,
+ organisational_unit,
+ root_common_name,
+ intermediate_common_name,
+ leaf_common_name
+ )
+ );
+}
+void
+Signer::create (boost::filesystem::path directory)
+{
_certificates.add (dcp::Certificate (dcp::file_to_string (directory / "ca.self-signed.pem")));
_certificates.add (dcp::Certificate (dcp::file_to_string (directory / "intermediate.signed.pem")));
_certificates.add (dcp::Certificate (dcp::file_to_string (directory / "leaf.signed.pem")));
@@ -52,7 +76,6 @@ Signer::Signer (boost::filesystem::path openssl)
boost::filesystem::remove_all (directory);
}
-
/** Add a &lt;Signer&gt; and &lt;ds:Signature&gt; nodes to an XML node.
* @param parent XML node to add to.