summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2017-05-17 09:49:15 +0100
committerCarl Hetherington <cth@carlh.net>2017-05-17 09:49:15 +0100
commite758024e07b64098dfdb67dcd54c828e374ca7b6 (patch)
tree4f46068b595a03439ca067a146c0f0eda09d9bc4
parentbe3aa4a24251f2b92724a90da95df0b98d16e69f (diff)
Add scope to KeyType tags in KDMs.
-rw-r--r--src/encrypted_kdm.cc2
-rw-r--r--test/data/kdm_TONEPLATES-SMPTE-ENC_.smpte-430-2.ROOT.NOT_FOR_PRODUCTION_20130706_20230702_CAR_OV_t1_8971c838.xml4
-rw-r--r--test/kdm_test.cc27
3 files changed, 31 insertions, 2 deletions
diff --git a/src/encrypted_kdm.cc b/src/encrypted_kdm.cc
index 8730bed9..b6a992fb 100644
--- a/src/encrypted_kdm.cc
+++ b/src/encrypted_kdm.cc
@@ -258,6 +258,8 @@ public:
/* XXX: this feels like a bit of a hack */
if (key_type == "MDEK") {
type->set_attribute ("scope", "http://www.dolby.com/cp850/2012/KDM#kdm-key-type");
+ } else {
+ type->set_attribute ("scope", "http://www.smpte-ra.org/430-1/2006/KDM#kdm-key-type");
}
}
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");
+ }
+ }
+}