summaryrefslogtreecommitdiff
path: root/src/xml/kdm_smpte.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/xml/kdm_smpte.h')
-rw-r--r--src/xml/kdm_smpte.h23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/xml/kdm_smpte.h b/src/xml/kdm_smpte.h
index 0139876f..32a297f8 100644
--- a/src/xml/kdm_smpte.h
+++ b/src/xml/kdm_smpte.h
@@ -170,6 +170,7 @@ public:
c = c->node_child ("KDMRequiredExtensions");
recipient = Recipient (c->node_child ("Recipient"));
composition_playlist_id = c->string_child ("CompositionPlaylistId");
+ content_authenticator = c->optional_string_child ("ContentAuthenticator");
content_title_text = c->string_child ("ContentTitleText");
content_keys_not_valid_before = c->string_child ("ContentKeysNotValidBefore");
content_keys_not_valid_after = c->string_child ("ContentKeysNotValidAfter");
@@ -209,6 +210,9 @@ public:
recipient.as_xml (kdm_required_extensions->add_child ("Recipient"));
kdm_required_extensions->add_child("CompositionPlaylistId")->add_child_text (composition_playlist_id);
+ if (content_authenticator) {
+ kdm_required_extensions->add_child("ContentAuthenticator")->add_child_text (content_authenticator.get ());
+ }
kdm_required_extensions->add_child("ContentTitleText")->add_child_text (content_title_text);
kdm_required_extensions->add_child("ContentKeysNotValidBefore")->add_child_text (content_keys_not_valid_before);
kdm_required_extensions->add_child("ContentKeysNotValidAfter")->add_child_text (content_keys_not_valid_after);
@@ -234,6 +238,7 @@ public:
Signer signer;
Recipient recipient;
std::string composition_playlist_id;
+ boost::optional<std::string> content_authenticator;
std::string content_title_text;
std::string content_keys_not_valid_before;
std::string content_keys_not_valid_after;
@@ -312,16 +317,12 @@ public:
node->done ();
}
- void as_xml (Writer& writer, xmlpp::Element* node) const
+ void as_xml (xmlpp::Element* node) const
{
xmlpp::Element* reference = node->add_child ("Reference", "ds");
reference->set_attribute ("URI", uri);
reference->add_child("DigestMethod", "ds")->set_attribute ("Algorithm", "http://www.w3.org/2001/04/xmlenc#sha256");
reference->add_child("DigestValue", "ds")->add_child_text (digest_value);
-
- if (!uri.empty ()) {
- xmlAddID (0, writer.document->cobj(), (const xmlChar *) uri.substr(1).c_str(), writer.references[uri.substr(1)]->cobj ());
- }
}
std::string uri;
@@ -359,14 +360,14 @@ public:
node->done ();
}
- void as_xml (Writer& writer, xmlpp::Element* node) const
+ void as_xml (xmlpp::Element* node) const
{
xmlpp::Element* si = node->add_child ("SignedInfo", "ds");
si->add_child ("CanonicalizationMethod", "ds")->set_attribute ("Algorithm", "http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments");
si->add_child ("SignatureMethod", "ds")->set_attribute ("Algorithm", "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256");
- authenticated_public.as_xml (writer, si);
- authenticated_private.as_xml (writer, si);
+ authenticated_public.as_xml (si);
+ authenticated_private.as_xml (si);
node->add_child("SignatureValue", "ds")->add_child_text (signature_value);
@@ -408,7 +409,11 @@ public:
authenticated_public.as_xml (writer, root->add_child ("AuthenticatedPublic"));
authenticated_private.as_xml (writer, root->add_child ("AuthenticatedPrivate"));
- signature.as_xml (writer, root->add_child ("Signature", "ds"));
+ signature.as_xml (root->add_child ("Signature", "ds"));
+
+ for (std::map<std::string, xmlpp::Attribute*>::const_iterator i = writer.references.begin(); i != writer.references.end(); ++i) {
+ xmlAddID (0, writer.document->cobj(), (const xmlChar *) i->first.c_str(), i->second->cobj ());
+ }
return writer.document;
}