#include "decrypted_kdm.h"
#include "decrypted_kdm_key.h"
#include "encrypted_kdm.h"
+#include "reel_mxf_asset.h"
#include "util.h"
#include "exceptions.h"
#include "cpl.h"
DecryptedKDM::DecryptedKDM (
boost::shared_ptr<const CPL> cpl,
+ Key key,
LocalTime not_valid_before,
LocalTime not_valid_after,
string annotation_text,
, _issue_date (issue_date)
{
/* Create DecryptedKDMKey objects for each MXF asset */
- list<shared_ptr<const Content> > content = cpl->content ();
- for (list<shared_ptr<const Content> >::iterator i = content.begin(); i != content.end(); ++i) {
+ list<shared_ptr<const ReelAsset> > assets = cpl->reel_assets ();
+ for (list<shared_ptr<const ReelAsset> >::iterator i = assets.begin(); i != assets.end(); ++i) {
/* XXX: do non-MXF assets need keys? */
- shared_ptr<const MXF> mxf = boost::dynamic_pointer_cast<const MXF> (*i);
+ shared_ptr<const ReelMXFAsset> mxf = boost::dynamic_pointer_cast<const ReelMXFAsset> (*i);
if (mxf) {
if (mxf->key_id().empty ()) {
- throw NotEncryptedError (mxf->file().string ());
+ throw NotEncryptedError (mxf->id());
}
- _keys.push_back (DecryptedKDMKey (mxf->key_type(), mxf->key_id(), mxf->key().get (), cpl->id ()));
+ _keys.push_back (DecryptedKDMKey (mxf->key_type(), mxf->key_id(), key, cpl->id ()));
}
}
}
EncryptedKDM
-DecryptedKDM::encrypt (shared_ptr<const Signer> signer, shared_ptr<const Certificate> recipient, Formulation formulation) const
+DecryptedKDM::encrypt (shared_ptr<const Signer> signer, Certificate recipient, Formulation formulation) const
{
list<pair<string, string> > key_ids;
list<string> keys;
uint8_t structure_id[] = { 0xf1, 0xdc, 0x12, 0x44, 0x60, 0x16, 0x9a, 0x0e, 0x85, 0xbc, 0x30, 0x06, 0x42, 0xf8, 0x66, 0xab };
put (&p, structure_id, 16);
- base64_decode (signer->certificates().leaf()->thumbprint (), p, 20);
+ base64_decode (signer->certificates().leaf().thumbprint (), p, 20);
p += 20;
put_uuid (&p, i->cpl_id ());
put (&p, i->key().value(), ASDCP::KeyLen);
/* Encrypt using the projector's public key */
- RSA* rsa = recipient->public_key ();
+ RSA* rsa = recipient.public_key ();
unsigned char encrypted[RSA_size(rsa)];
int const encrypted_len = RSA_public_encrypt (p - block, block, encrypted, rsa, RSA_PKCS1_OAEP_PADDING);
if (encrypted_len == -1) {
keys.push_back (lines.str ());
}
- string device_list_description = recipient->common_name ();
+ string device_list_description = recipient.common_name ();
if (device_list_description.find (".") != string::npos) {
device_list_description = device_list_description.substr (device_list_description.find (".") + 1);
}