summaryrefslogtreecommitdiff
path: root/src/cpl.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2019-01-20 20:26:41 +0000
committerCarl Hetherington <cth@carlh.net>2019-01-24 02:03:05 +0000
commita266fc223ecb7a696fa9dc35422ef0264b1c3c40 (patch)
tree27273528c69e91c7461d9349f9f1467886ddf977 /src/cpl.cc
parent49f9ec23d00bec2f284118fed3d48d10a6cc8537 (diff)
Attempt to fix Sony digest validation by indenting the <Signer>
and <Signature> before signing. This is in the belief that, perhaps, the Sony software "reformats" the XML before checking that the signature is correct (or something).
Diffstat (limited to 'src/cpl.cc')
-rw-r--r--src/cpl.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/cpl.cc b/src/cpl.cc
index 726d69b7..4a594b5a 100644
--- a/src/cpl.cc
+++ b/src/cpl.cc
@@ -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);
}