From f4e3b9c0b4027018c39b9085e080325c19ac9164 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Thu, 11 Sep 2014 14:06:19 +0100 Subject: Allow Signer and certificate chains to be made with specified organisation, common name etc. --- src/signer.cc | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'src/signer.cc') 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 <Signer> and <ds:Signature> nodes to an XML node. * @param parent XML node to add to. -- cgit v1.2.3