diff options
| author | Carl Hetherington <cth@carlh.net> | 2013-09-21 20:16:11 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2013-09-21 20:16:11 +0100 |
| commit | 66ef19cdb8ab4e4613762acee98a2bcb999ab65c (patch) | |
| tree | 10cc30f8f0758e12fe7a7119d3b898dbdca7dcfa /src/cpl.cc | |
| parent | 864bbcc3f293bf60c05fda02b0d15c3f604eacc8 (diff) | |
Unbuilt KDM changes.
Diffstat (limited to 'src/cpl.cc')
| -rw-r--r-- | src/cpl.cc | 24 |
1 files changed, 17 insertions, 7 deletions
@@ -348,7 +348,6 @@ shared_ptr<xmlpp::Document> CPL::make_kdm ( shared_ptr<const Signer> signer, shared_ptr<const Certificate> recipient_cert, - Key key, boost::posix_time::ptime from, boost::posix_time::ptime until, bool interop, @@ -446,12 +445,23 @@ CPL::make_kdm ( authenticated_private->set_attribute ("Id", "ID_AuthenticatedPrivate"); xmlAddID (0, doc->cobj(), (const xmlChar *) "ID_AuthenticatedPrivate", authenticated_private->get_attribute("Id")->cobj()); - xmlpp::Element* encrypted_key = authenticated_private->add_child ("EncryptedKey", "enc"); - xmlpp::Element* encryption_method = encrypted_key->add_child ("EncryptionMethod", "enc"); - encryption_method->set_attribute ("Algorithm", "http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p"); - encryption_method->add_child("DigestMethod", "ds")->set_attribute("Algorithm", "http://www.w3.org/2000/09/xmldsig#sha1"); - xmlpp::Element* cipher_data = authenticated_private->add_child ("CipherData", "enc"); - cipher_data->add_child("CipherValue", "enc")->add_child_text(key.hex()); + list<shared_ptr<const Asset> > a = assets(); + for (list<shared_ptr<const Asset> >::iterator i = a.begin(); i != a.end(); ++i) { + /* XXX: non-MXF assets? */ + shared_ptr<const MXFAsset> mxf = boost::dynamic_pointer_cast<const MXFAsset> (*i); + if (!mxf) { + continue; + } + + xmlpp::Element* encrypted_key = authenticated_private->add_child ("EncryptedKey", "enc"); + xmlpp::Element* encryption_method = encrypted_key->add_child ("EncryptionMethod", "enc"); + encryption_method->set_attribute ("Algorithm", "http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p"); + encryption_method->add_child("DigestMethod", "ds")->set_attribute("Algorithm", "http://www.w3.org/2000/09/xmldsig#sha1"); + xmlpp::Element* cipher_data = encrypted_key->add_child ("CipherData", "enc"); + + KDMKey kkey (signer, _id, mxf->key_id (), from, until, mxf->key ()); + cipher_data->add_child("CipherValue", "enc")->add_child_text (kkey.base64 ()); + } } { |
