X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fencrypted_kdm.cc;h=5b596b80baac7864f9b10762e31508bacb35db81;hb=14848004f619d11bd6810735637d428f101e6b51;hp=fe96250fb759f3658a9ef0a016fee058bf7124fe;hpb=9e523d8a4062ad52330dff6c2ba50e54184c9bb2;p=libdcp.git diff --git a/src/encrypted_kdm.cc b/src/encrypted_kdm.cc index fe96250f..5b596b80 100644 --- a/src/encrypted_kdm.cc +++ b/src/encrypted_kdm.cc @@ -19,7 +19,7 @@ #include "encrypted_kdm.h" #include "util.h" -#include "signer.h" +#include "certificate_chain.h" #include #include #include @@ -269,7 +269,7 @@ public: AuthorizedDeviceInfo (shared_ptr node) : device_list_identifier (node->string_child ("DeviceListIdentifier").substr (9)) - , device_list_description (node->string_child ("DeviceListDescription")) + , device_list_description (node->optional_string_child ("DeviceListDescription")) , certificate_thumbprint (node->node_child("DeviceList")->string_child ("CertificateThumbprint")) { @@ -278,14 +278,16 @@ public: void as_xml (xmlpp::Element* node) const { node->add_child ("DeviceListIdentifier")->add_child_text ("urn:uuid:" + device_list_identifier); - node->add_child ("DeviceListDescription")->add_child_text (device_list_description); + if (device_list_description) { + node->add_child ("DeviceListDescription")->add_child_text (device_list_description.get()); + } xmlpp::Element* device_list = node->add_child ("DeviceList"); device_list->add_child("CertificateThumbprint")->add_child_text (certificate_thumbprint); } /** DeviceListIdentifier without the urn:uuid: prefix */ string device_list_identifier; - string device_list_description; + boost::optional device_list_description; string certificate_thumbprint; }; @@ -492,7 +494,7 @@ EncryptedKDM::EncryptedKDM (string s) } EncryptedKDM::EncryptedKDM ( - shared_ptr signer, + shared_ptr signer, Certificate recipient, string device_list_description, string cpl_id, @@ -508,8 +510,8 @@ EncryptedKDM::EncryptedKDM ( /* Fill our XML-ish description in with the juicy bits that the caller has given */ data::AuthenticatedPublic& aup = _data->authenticated_public; - aup.signer.x509_issuer_name = signer->certificates().leaf().issuer (); - aup.signer.x509_serial_number = signer->certificates().leaf().serial (); + aup.signer.x509_issuer_name = signer->leaf().issuer (); + aup.signer.x509_serial_number = signer->leaf().serial (); data::KDMRequiredExtensions& kre = _data->authenticated_public.required_extensions.kdm_required_extensions; kre.recipient.x509_issuer_serial.x509_issuer_name = recipient.issuer (); @@ -518,13 +520,13 @@ EncryptedKDM::EncryptedKDM ( kre.authorized_device_info.device_list_description = device_list_description; kre.composition_playlist_id = cpl_id; if (formulation == DCI_ANY || formulation == DCI_SPECIFIC) { - kre.content_authenticator = signer->certificates().leaf().thumbprint (); + kre.content_authenticator = signer->leaf().thumbprint (); } kre.content_title_text = content_title_text; kre.not_valid_before = not_valid_before; kre.not_valid_after = not_valid_after; kre.authorized_device_info.device_list_identifier = make_uuid (); - string n = recipient.common_name (); + string n = recipient.subject_common_name (); if (n.find (".") != string::npos) { n = n.substr (n.find (".") + 1); }