Put xmlns:dsig on Signer and Signature rather than on the whole
authorCarl Hetherington <cth@carlh.net>
Wed, 21 Mar 2018 23:08:20 +0000 (23:08 +0000)
committerCarl Hetherington <cth@carlh.net>
Wed, 21 Mar 2018 23:08:20 +0000 (23:08 +0000)
CPL/PKL as a certain large distribution company's checkers don't
like having multiple namespaces:

"XML root element can contain only one namespace"

src/certificate_chain.cc
src/cpl.cc
src/dcp.cc

index 851252afdfd9b9432a9563d290f524db5c984136..d30e6567f2ee24e366752f70b89dcada304fa67e 100644 (file)
@@ -563,6 +563,7 @@ CertificateChain::sign (xmlpp::Element* parent, Standard standard) const
        /* <Signer> */
 
        xmlpp::Element* signer = parent->add_child("Signer");
+       signer->set_namespace_declaration ("http://www.w3.org/2000/09/xmldsig#", "dsig");
        xmlpp::Element* data = signer->add_child("X509Data", "dsig");
        xmlpp::Element* serial_element = data->add_child("X509IssuerSerial", "dsig");
        serial_element->add_child("X509IssuerName", "dsig")->add_child_text (leaf().issuer());
@@ -571,7 +572,9 @@ CertificateChain::sign (xmlpp::Element* parent, Standard standard) const
 
        /* <Signature> */
 
-       xmlpp::Element* signature = parent->add_child("Signature", "dsig");
+       xmlpp::Element* signature = parent->add_child("Signature");
+       signature->set_namespace_declaration ("http://www.w3.org/2000/09/xmldsig#", "dsig");
+       signature->set_namespace ("dsig");
 
        xmlpp::Element* signed_info = signature->add_child ("SignedInfo", "dsig");
        signed_info->add_child("CanonicalizationMethod", "dsig")->set_attribute ("Algorithm", "http://www.w3.org/TR/2001/REC-xml-c14n-20010315");
index f807bc61c5cf00672b7e8ca2cf5d15b1db9e2860..aa61ec7afcc55052722369537b32262de61869cb 100644 (file)
@@ -140,10 +140,6 @@ CPL::write_xml (boost::filesystem::path file, Standard standard, shared_ptr<cons
                root = doc.create_root_node ("CompositionPlaylist", cpl_smpte_ns);
        }
 
-       if (signer) {
-               root->set_namespace_declaration ("http://www.w3.org/2000/09/xmldsig#", "dsig");
-       }
-
        root->add_child("Id")->add_child_text ("urn:uuid:" + _id);
        root->add_child("AnnotationText")->add_child_text (_metadata.annotation_text);
        root->add_child("IssueDate")->add_child_text (_metadata.issue_date);
index 7b4f9bdaac3efe05129877c465b3f715d3835b6d..e56547e3dc2e7d265161bbf03abb2fbe1883acce 100644 (file)
@@ -321,10 +321,6 @@ DCP::write_pkl (string file, Standard standard, string pkl_uuid, XMLMetadata met
                pkl = doc.create_root_node("PackingList", pkl_smpte_ns);
        }
 
-       if (signer) {
-               pkl->set_namespace_declaration ("http://www.w3.org/2000/09/xmldsig#", "dsig");
-       }
-
        pkl->add_child("Id")->add_child_text ("urn:uuid:" + pkl_uuid);
        pkl->add_child("AnnotationText")->add_child_text (metadata.annotation_text);
        pkl->add_child("IssueDate")->add_child_text (metadata.issue_date);