Attempt to fix Sony digest validation by indenting the <Signer>
[libdcp.git] / src / cpl.cc
index 726d69b722ef6f35f5f92d0491d3349a81450a08..4a594b5a477a305d65a2337ceadbe28f814b3f16 100644 (file)
@@ -140,6 +140,10 @@ 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);
@@ -164,8 +168,7 @@ CPL::write_xml (boost::filesystem::path file, Standard standard, shared_ptr<cons
                signer->sign (root, standard);
        }
 
-       /* This must not be the _formatted version otherwise signature digests will be wrong */
-       doc.write_to_file (file.string (), "UTF-8");
+       doc.write_to_file_formatted (file.string(), "UTF-8");
 
        set_file (file);
 }