Test KDMKeys reload.
authorCarl Hetherington <cth@carlh.net>
Sun, 29 Sep 2013 08:12:31 +0000 (09:12 +0100)
committerCarl Hetherington <cth@carlh.net>
Sun, 29 Sep 2013 08:12:31 +0000 (09:12 +0100)
test/round_trip_test.cc

index 2747a71fb840aa89c0b5bfad64995e3f5d2271e0..fe7201423cab550b2eb5cedecd418259ed578e67 100644 (file)
@@ -31,6 +31,7 @@
 #include "argb_frame.h"
 #include "signer_chain.h"
 
+using std::list;
 using boost::shared_ptr;
 
 /* Build an encrypted picture MXF and a KDM for it and check that the KDM can be decrypted */
@@ -86,6 +87,18 @@ BOOST_AUTO_TEST_CASE (round_trip_test)
        /* Reload the KDM, using our private key to decrypt it */
        libdcp::KDM kdm_B (kdm_file, "build/test/signer/leaf.key");
 
+       /* Check that the decrypted KDMKeys are the same as the ones we started with */
+       BOOST_CHECK_EQUAL (kdm_A.keys().size(), kdm_B.keys().size());
+       list<libdcp::KDMKey> keys_A = kdm_A.keys ();
+       list<libdcp::KDMKey> keys_B = kdm_B.keys ();
+       list<libdcp::KDMKey>::const_iterator i = keys_A.begin();
+       list<libdcp::KDMKey>::const_iterator j = keys_B.begin();
+       while (i != keys_A.end ()) {
+               BOOST_CHECK (*i == *j);
+               ++i;
+               ++j;
+       }
+
        /* Reload the picture MXF */
        shared_ptr<libdcp::MonoPictureAsset> asset_B (
                new libdcp::MonoPictureAsset (work_dir, "video.mxf")