From d926e11dab4dbe72cf427b5a25ca18ec3d38a40b Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 24 Apr 2016 23:00:34 +0100 Subject: KDM AnnotationText is optional. --- src/decrypted_kdm.cc | 2 +- src/decrypted_kdm.h | 7 ++++--- src/encrypted_kdm.cc | 13 ++++++++----- src/encrypted_kdm.h | 5 +++-- 4 files changed, 16 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/decrypted_kdm.cc b/src/decrypted_kdm.cc index 99cbca10..6aba26de 100644 --- a/src/decrypted_kdm.cc +++ b/src/decrypted_kdm.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2013-2015 Carl Hetherington + Copyright (C) 2013-2016 Carl Hetherington This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/src/decrypted_kdm.h b/src/decrypted_kdm.h index f7d21dbe..21df45a1 100644 --- a/src/decrypted_kdm.h +++ b/src/decrypted_kdm.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2013-2015 Carl Hetherington + Copyright (C) 2013-2016 Carl Hetherington This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -30,6 +30,7 @@ #include "types.h" #include "certificate.h" #include +#include namespace dcp { @@ -110,7 +111,7 @@ public: return _keys; } - std::string annotation_text () const { + boost::optional annotation_text () const { return _annotation_text; } @@ -125,7 +126,7 @@ public: private: LocalTime _not_valid_before; LocalTime _not_valid_after; - std::string _annotation_text; + boost::optional _annotation_text; std::string _content_title_text; std::string _issue_date; std::list _keys; diff --git a/src/encrypted_kdm.cc b/src/encrypted_kdm.cc index 132e8df3..8ed0c315 100644 --- a/src/encrypted_kdm.cc +++ b/src/encrypted_kdm.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2013-2015 Carl Hetherington + Copyright (C) 2013-2016 Carl Hetherington This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -33,6 +33,7 @@ using std::string; using std::map; using std::pair; using boost::shared_ptr; +using boost::optional; using namespace dcp; namespace dcp { @@ -427,7 +428,7 @@ public: AuthenticatedPublic (shared_ptr node) : message_id (remove_urn_uuid (node->string_child ("MessageId"))) - , annotation_text (node->string_child ("AnnotationText")) + , annotation_text (node->optional_string_child ("AnnotationText")) , issue_date (node->string_child ("IssueDate")) , signer (node->node_child ("Signer")) , required_extensions (node->node_child ("RequiredExtensions")) @@ -441,7 +442,9 @@ public: node->add_child("MessageId")->add_child_text ("urn:uuid:" + message_id); node->add_child("MessageType")->add_child_text ("http://www.smpte-ra.org/430-1/2006/KDM#kdm-key-type"); - node->add_child("AnnotationText")->add_child_text (annotation_text); + if (annotation_text) { + node->add_child("AnnotationText")->add_child_text (annotation_text.get ()); + } node->add_child("IssueDate")->add_child_text (issue_date); signer.as_xml (node->add_child ("Signer")); @@ -451,7 +454,7 @@ public: } string message_id; - string annotation_text; + optional annotation_text; string issue_date; Signer signer; RequiredExtensions required_extensions; @@ -628,7 +631,7 @@ EncryptedKDM::keys () const return _data->authenticated_private.encrypted_key; } -string +optional EncryptedKDM::annotation_text () const { return _data->authenticated_public.annotation_text; diff --git a/src/encrypted_kdm.h b/src/encrypted_kdm.h index c899dcbe..a36e7aaf 100644 --- a/src/encrypted_kdm.h +++ b/src/encrypted_kdm.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2013-2014 Carl Hetherington + Copyright (C) 2013-2016 Carl Hetherington This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -27,6 +27,7 @@ #include "local_time.h" #include "types.h" #include +#include #include namespace cxml { @@ -71,7 +72,7 @@ public: */ std::list keys () const; - std::string annotation_text () const; + boost::optional annotation_text () const; std::string content_title_text () const; std::string issue_date () const; std::string cpl_id () const; -- cgit v1.2.3