diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/data/kdm_TONEPLATES-SMPTE-ENC_.smpte-430-2.ROOT.NOT_FOR_PRODUCTION_20130706_20230702_CAR_OV_t1_8971c838.xml | 4 | ||||
| -rw-r--r-- | test/kdm_test.cc | 27 |
2 files changed, 29 insertions, 2 deletions
diff --git a/test/data/kdm_TONEPLATES-SMPTE-ENC_.smpte-430-2.ROOT.NOT_FOR_PRODUCTION_20130706_20230702_CAR_OV_t1_8971c838.xml b/test/data/kdm_TONEPLATES-SMPTE-ENC_.smpte-430-2.ROOT.NOT_FOR_PRODUCTION_20130706_20230702_CAR_OV_t1_8971c838.xml index 9047fa03..d056351f 100644 --- a/test/data/kdm_TONEPLATES-SMPTE-ENC_.smpte-430-2.ROOT.NOT_FOR_PRODUCTION_20130706_20230702_CAR_OV_t1_8971c838.xml +++ b/test/data/kdm_TONEPLATES-SMPTE-ENC_.smpte-430-2.ROOT.NOT_FOR_PRODUCTION_20130706_20230702_CAR_OV_t1_8971c838.xml @@ -32,11 +32,11 @@ </AuthorizedDeviceInfo> <KeyIdList> <TypedKeyId> - <KeyType>MDIK</KeyType> + <KeyType scope="http://www.smpte-ra.org/430-1/2006/KDM#kdm-key-type">MDIK</KeyType> <KeyId>urn:uuid:4ac4f922-8239-4831-b23b-31426d0542c4</KeyId> </TypedKeyId> <TypedKeyId> - <KeyType>MDAK</KeyType> + <KeyType scope="http://www.smpte-ra.org/430-1/2006/KDM#kdm-key-type">MDAK</KeyType> <KeyId>urn:uuid:73baf5de-e195-4542-ab28-8a465f7d4079</KeyId> </TypedKeyId> </KeyIdList> 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 <libcxml/cxml.h> #include <libxml++/libxml++.h> #include <boost/test/unit_test.hpp> +#include <boost/foreach.hpp> using std::list; using boost::shared_ptr; @@ -99,3 +101,28 @@ BOOST_AUTO_TEST_CASE (decrypted_kdm_test) delete[] data; } + +/** Check that <KeyType> 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<cxml::NodePtr> 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"); + } + } +} |
