diff options
| author | Carl Hetherington <cth@carlh.net> | 2014-09-11 14:06:19 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2014-09-11 14:06:19 +0100 |
| commit | f4e3b9c0b4027018c39b9085e080325c19ac9164 (patch) | |
| tree | ec6319337e328d0a26fd7daddb004d411bf76e20 /src/certificate_chain.cc | |
| parent | f0da23525fd60c4c9f054e5d603adb1b7ec05d19 (diff) | |
Allow Signer and certificate chains to be made with specified organisation, common name etc.
Diffstat (limited to 'src/certificate_chain.cc')
| -rw-r--r-- | src/certificate_chain.cc | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/src/certificate_chain.cc b/src/certificate_chain.cc index 5d01790b..b2ebeca8 100644 --- a/src/certificate_chain.cc +++ b/src/certificate_chain.cc @@ -157,7 +157,14 @@ public_key_digest (boost::filesystem::path private_key, boost::filesystem::path } boost::filesystem::path -dcp::make_certificate_chain (boost::filesystem::path openssl) +dcp::make_certificate_chain ( + boost::filesystem::path openssl, + string organisation, + string organisational_unit, + string root_common_name, + string intermediate_common_name, + string leaf_common_name + ) { boost::filesystem::path directory = boost::filesystem::temp_directory_path() / boost::filesystem::unique_path (); boost::filesystem::create_directories (directory); @@ -185,7 +192,10 @@ dcp::make_certificate_chain (boost::filesystem::path openssl) << "CN = Entity and dnQualifier\n"; } - string const ca_subject = "/O=example.org/OU=example.org/CN=.smpte-430-2.ROOT.NOT_FOR_PRODUCTION/dnQualifier=" + public_key_digest ("ca.key", openssl); + string const ca_subject = "/O=" + organisation + + "/OU=" + organisational_unit + + "/CN=" + root_common_name + + "/dnQualifier=" + public_key_digest ("ca.key", openssl); { stringstream c; @@ -213,8 +223,10 @@ dcp::make_certificate_chain (boost::filesystem::path openssl) << "CN = Entity and dnQualifier\n"; } - string const inter_subject = "/O=example.org/OU=example.org/CN=.smpte-430-2.INTERMEDIATE.NOT_FOR_PRODUCTION/dnQualifier=" - + public_key_digest ("intermediate.key", openssl); + string const inter_subject = "/O=" + organisation + + "/OU=" + organisational_unit + + "/CN=" + intermediate_common_name + + "/dnQualifier=" + public_key_digest ("intermediate.key", openssl); { stringstream s; @@ -248,8 +260,10 @@ dcp::make_certificate_chain (boost::filesystem::path openssl) << "CN = Entity and dnQualifier\n"; } - string const leaf_subject = "/O=example.org/OU=example.org/CN=CS.smpte-430-2.LEAF.NOT_FOR_PRODUCTION/dnQualifier=" - + public_key_digest ("leaf.key", openssl); + string const leaf_subject = "/O=" + organisation + + "/OU=" + organisational_unit + + "/CN=" + leaf_common_name + + "/dnQualifier=" + public_key_digest ("leaf.key", openssl); { stringstream s; |
