diff options
| author | Carl Hetherington <cth@carlh.net> | 2017-05-17 09:49:15 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2017-05-17 09:49:15 +0100 |
| commit | e758024e07b64098dfdb67dcd54c828e374ca7b6 (patch) | |
| tree | 4f46068b595a03439ca067a146c0f0eda09d9bc4 /test/kdm_test.cc | |
| parent | be3aa4a24251f2b92724a90da95df0b98d16e69f (diff) | |
Add scope to KeyType tags in KDMs.
Diffstat (limited to 'test/kdm_test.cc')
| -rw-r--r-- | test/kdm_test.cc | 27 |
1 files changed, 27 insertions, 0 deletions
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"); + } + } +} |
