diff options
| author | Carl Hetherington <cth@carlh.net> | 2019-03-14 17:01:47 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2019-03-14 17:01:47 +0000 |
| commit | 50bfe5a5a595f8200811d6916a777e24c880b441 (patch) | |
| tree | af7a175ff6415ec58e78cec8f14f2190d0dc980f /tools | |
| parent | f218289708a9912f73707cb4bef13ffc469c1296 (diff) | |
Some new features in dcpkdm.
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/dcpkdm.cc | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/tools/dcpkdm.cc b/tools/dcpkdm.cc index a04e4ba0..6ffabfe7 100644 --- a/tools/dcpkdm.cc +++ b/tools/dcpkdm.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2017 Carl Hetherington <cth@carlh.net> + Copyright (C) 2017-2019 Carl Hetherington <cth@carlh.net> This file is part of libdcp. @@ -35,6 +35,7 @@ #include "decrypted_kdm.h" #include "util.h" #include "exceptions.h" +#include "certificate_chain.h" #include <boost/foreach.hpp> #include <getopt.h> @@ -51,6 +52,14 @@ help (string n) << " -p, --private-key private key file\n"; } +static string +tm_to_string (struct tm t) +{ + char buffer[64]; + snprintf (buffer, 64, "%02d/%02d/%02d %02d:%02d:%02d", t.tm_mday, t.tm_mon, (t.tm_year + 1900), t.tm_hour, t.tm_min, t.tm_sec); + return buffer; +} + int main (int argc, char* argv[]) { @@ -96,6 +105,18 @@ main (int argc, char* argv[]) cout << "CPL id: " << enc_kdm.cpl_id() << "\n"; cout << "Recipient: " << enc_kdm.recipient_x509_subject_name() << "\n"; + cout << "Signer chain:\n"; + dcp::CertificateChain signer = enc_kdm.signer_certificate_chain (); + BOOST_FOREACH (dcp::Certificate const & i, signer.root_to_leaf()) { + cout << "\tCertificate:\n"; + cout << "\t\tSubject: " << i.subject() << "\n"; + cout << "\t\tSubject common name: " << i.subject_common_name() << "\n"; + cout << "\t\tSubject organization name: " << i.subject_organization_name() << "\n"; + cout << "\t\tSubject organizational unit name: " << i.subject_organizational_unit_name() << "\n"; + cout << "\t\tNot before: " << tm_to_string(i.not_before()) << "\n"; + cout << "\t\tNot after: " << tm_to_string(i.not_after()) << "\n"; + } + if (private_key_file) { try { dcp::DecryptedKDM dec_kdm (enc_kdm, dcp::file_to_string (private_key_file.get())); |
