#include "encrypted_kdm.h"
#include "util.h"
-#include "signer.h"
+#include "certificate_chain.h"
#include <libcxml/cxml.h>
#include <libxml++/document.h>
#include <libxml++/nodes/element.h>
AuthorizedDeviceInfo (shared_ptr<const cxml::Node> 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"))
{
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<string> device_list_description;
string certificate_thumbprint;
};
}
EncryptedKDM::EncryptedKDM (
- shared_ptr<const Signer> signer,
+ shared_ptr<const CertificateChain> signer,
Certificate recipient,
string device_list_description,
string cpl_id,
/* 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 ();
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);
}