From 8e89905d0391f2b77253fe04ad1af285b2c6fec4 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 4 Jun 2024 21:01:53 +0200 Subject: Add an option to dump the decryption certificate from the KDM CLI. --- src/lib/kdm_cli.cc | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'src/lib/kdm_cli.cc') diff --git a/src/lib/kdm_cli.cc b/src/lib/kdm_cli.cc index 2d3a021b5..ea6353ff6 100644 --- a/src/lib/kdm_cli.cc +++ b/src/lib/kdm_cli.cc @@ -76,6 +76,7 @@ help (std::function out) out (" -C, --certificate file containing projector certificate"); out (" -T, --trusted-device file containing a trusted device's certificate"); out (" --cinemas-file use the given file as a list of cinemas instead of the current configuration"); + out (" --dump-decryption-certificate write the DCP-o-matic KDM decryption certificate to the console"); out (" --list-cinemas list known cinemas from the DCP-o-matic settings"); out (" --list-dkdm-cpls list CPLs for which DCP-o-matic has DKDMs"); out (""); @@ -440,6 +441,17 @@ dump_dkdm_group (shared_ptr group, int indent, std::function out) +{ + vector lines; + boost::split(lines, Config::instance()->decryption_chain()->leaf().certificate(true), boost::is_any_of("\n")); + for (auto const& line: lines) { + out(line); + } +} + + optional kdm_cli (int argc, char* argv[], std::function out) try @@ -494,10 +506,11 @@ try { "list-cinemas", no_argument, 0, 'B' }, { "list-dkdm-cpls", no_argument, 0, 'D' }, { "cinemas-file", required_argument, 0, 'E' }, + { "dump-decryption-certificate", no_argument, 0, 'G' }, { 0, 0, 0, 0 } }; - int c = getopt_long (argc, argv, "ho:K:Z:f:t:d:F:pae::zvc:S:C:T:BDE:", long_options, &option_index); + int c = getopt_long (argc, argv, "ho:K:Z:f:t:d:F:pae::zvc:S:C:T:BDE:G", long_options, &option_index); if (c == -1) { break; @@ -590,6 +603,9 @@ try case 'E': cinemas_file = optarg; break; + case 'G': + dump_decryption_certificate(out); + return {}; } } -- cgit v1.2.3