X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fdecrypted_kdm.cc;h=99cbca10ff040bd1b87eca376f490e45baaf9e2b;hb=689d56339857b0a82156641f28392b8d2f11beea;hp=949db72bdcc6e763767e7c24fea85d1af3d7ddae;hpb=57b862d997857868d0c3c91a9776f854b62c6b56;p=libdcp.git diff --git a/src/decrypted_kdm.cc b/src/decrypted_kdm.cc index 949db72b..99cbca10 100644 --- a/src/decrypted_kdm.cc +++ b/src/decrypted_kdm.cc @@ -36,6 +36,7 @@ #include using std::list; +using std::vector; using std::string; using std::stringstream; using std::setw; @@ -181,6 +182,26 @@ DecryptedKDM::DecryptedKDM (EncryptedKDM const & kdm, string private_key) RSA_free (rsa); BIO_free (bio); + + _annotation_text = kdm.annotation_text (); + _content_title_text = kdm.content_title_text (); + _issue_date = kdm.issue_date (); +} + +DecryptedKDM::DecryptedKDM ( + LocalTime not_valid_before, + LocalTime not_valid_after, + string annotation_text, + string content_title_text, + string issue_date + ) + : _not_valid_before (not_valid_before) + , _not_valid_after (not_valid_after) + , _annotation_text (annotation_text) + , _content_title_text (content_title_text) + , _issue_date (issue_date) +{ + } DecryptedKDM::DecryptedKDM ( @@ -211,8 +232,25 @@ DecryptedKDM::DecryptedKDM ( } } +/** @param type (MDIK, MDAK etc.) + * @param key_id Key ID. + * @param key The actual symmetric key. + * @param cpl_id ID of CPL that the key is for. + */ +void +DecryptedKDM::add_key (string type, string key_id, Key key, string cpl_id) +{ + _keys.push_back (DecryptedKDMKey (type, key_id, key, cpl_id)); +} + +void +DecryptedKDM::add_key (DecryptedKDMKey key) +{ + _keys.push_back (key); +} + EncryptedKDM -DecryptedKDM::encrypt (shared_ptr signer, Certificate recipient, Formulation formulation) const +DecryptedKDM::encrypt (shared_ptr signer, Certificate recipient, vector trusted_devices, Formulation formulation) const { list > key_ids; list keys; @@ -268,6 +306,7 @@ DecryptedKDM::encrypt (shared_ptr signer, Certificate re return EncryptedKDM ( signer, recipient, + trusted_devices, device_list_description, _keys.front().cpl_id (), _content_title_text,