summaryrefslogtreecommitdiff
path: root/test/kdm_test.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-07-06 23:31:16 +0100
committerCarl Hetherington <cth@carlh.net>2013-07-06 23:31:16 +0100
commit4313456938d34d93239194e914b82e7a5ae14c1c (patch)
tree622dffc47d90a14b70eecd35b0e5717a9b80fade /test/kdm_test.cc
parent3340b9a66ca2153daf8568ae147abcc9c5983323 (diff)
Can decrypt a KDM.
Diffstat (limited to 'test/kdm_test.cc')
-rw-r--r--test/kdm_test.cc44
1 files changed, 44 insertions, 0 deletions
diff --git a/test/kdm_test.cc b/test/kdm_test.cc
new file mode 100644
index 00000000..172661e3
--- /dev/null
+++ b/test/kdm_test.cc
@@ -0,0 +1,44 @@
+/*
+ Copyright (C) 2013 Carl Hetherington <cth@carlh.net>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "kdm.h"
+
+BOOST_AUTO_TEST_CASE (kdm_test)
+{
+ libdcp::KDM kdm (
+ "test/data/kdm_TONEPLATES-SMPTE-ENC_.smpte-430-2.ROOT.NOT_FOR_PRODUCTION_20130706_20230702_CAR_OV_t1_8971c838.xml",
+ "test/data/private.key"
+ );
+
+ list<libdcp::KDMCipher> ciphers = kdm.ciphers ();
+
+ BOOST_CHECK_EQUAL (ciphers.size(), 2);
+
+ BOOST_CHECK_EQUAL (ciphers.front().cpl_id(), "eece17de-77e8-4a55-9347-b6bab5724b9f");
+ BOOST_CHECK_EQUAL (ciphers.front().key_id(), "4ac4f922-8239-4831-b23b-31426d0542c4");
+ BOOST_CHECK_EQUAL (ciphers.front().not_valid_before(), "2013-07-06T20:04:58+00:00");
+ BOOST_CHECK_EQUAL (ciphers.front().not_valid_after(), "2023-07-02T20:04:56+00:00");
+ BOOST_CHECK_EQUAL (ciphers.front().key_data(), "8a2729c3e5b65c45d78305462104c3fb");
+
+ BOOST_CHECK_EQUAL (ciphers.back().cpl_id(), "eece17de-77e8-4a55-9347-b6bab5724b9f");
+ BOOST_CHECK_EQUAL (ciphers.back().key_id(), "73baf5de-e195-4542-ab28-8a465f7d4079");
+ BOOST_CHECK_EQUAL (ciphers.back().not_valid_before(), "2013-07-06T20:04:58+00:00");
+ BOOST_CHECK_EQUAL (ciphers.back().not_valid_after(), "2023-07-02T20:04:56+00:00");
+ BOOST_CHECK_EQUAL (ciphers.back().key_data(), "5327fb7ec2e807bd57059615bf8a169d");
+}