From e758024e07b64098dfdb67dcd54c828e374ca7b6 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Wed, 17 May 2017 09:49:15 +0100 Subject: Add scope to KeyType tags in KDMs. --- test/kdm_test.cc | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'test/kdm_test.cc') diff --git a/test/kdm_test.cc b/test/kdm_test.cc index d8ae4222..c007a7fa 100644 --- a/test/kdm_test.cc +++ b/test/kdm_test.cc @@ -20,8 +20,10 @@ #include "encrypted_kdm.h" #include "decrypted_kdm.h" #include "util.h" +#include #include #include +#include using std::list; using boost::shared_ptr; @@ -99,3 +101,28 @@ BOOST_AUTO_TEST_CASE (decrypted_kdm_test) delete[] data; } + +/** Check that tags have the scope attribute. + * Wolfgang Woehl believes this is compulsory and I am more-or-less inclined to agree. + */ +BOOST_AUTO_TEST_CASE (kdm_key_type_scope) +{ + dcp::EncryptedKDM kdm ( + dcp::file_to_string ("test/data/kdm_TONEPLATES-SMPTE-ENC_.smpte-430-2.ROOT.NOT_FOR_PRODUCTION_20130706_20230702_CAR_OV_t1_8971c838.xml") + ); + + cxml::Document doc; + doc.read_string (kdm.as_xml ()); + + list typed_key_ids = doc.node_child("AuthenticatedPublic")-> + node_child("RequiredExtensions")-> + node_child("KDMRequiredExtensions")-> + node_child("KeyIdList")-> + node_children("TypedKeyId"); + + BOOST_FOREACH (cxml::NodePtr i, typed_key_ids) { + BOOST_FOREACH (cxml::NodePtr j, i->node_children("KeyType")) { + BOOST_CHECK (j->string_attribute("scope") == "http://www.smpte-ra.org/430-1/2006/KDM#kdm-key-type"); + } + } +} -- cgit v1.2.3