summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2017-02-14 16:43:59 +0000
committerCarl Hetherington <cth@carlh.net>2017-02-14 16:43:59 +0000
commitadb4f8a5014c3888f3322d1765fb0ee52b1d3169 (patch)
treeb8b06de0a2138d42efa44fa537a51492328d630a /src
parentb8ae635ba057c68eb1d883e62df353f73def3c57 (diff)
Extract KDM standard.
Diffstat (limited to 'src')
-rw-r--r--src/decrypted_kdm.cc16
-rw-r--r--src/decrypted_kdm.h2
-rw-r--r--src/decrypted_kdm_key.cc7
-rw-r--r--src/decrypted_kdm_key.h15
4 files changed, 30 insertions, 10 deletions
diff --git a/src/decrypted_kdm.cc b/src/decrypted_kdm.cc
index 7113afb8..72070fe7 100644
--- a/src/decrypted_kdm.cc
+++ b/src/decrypted_kdm.cc
@@ -170,7 +170,7 @@ DecryptedKDM::DecryptedKDM (EncryptedKDM const & kdm, string private_key)
/* 93 is not-valid-after (a string) [25 bytes] */
p += 25;
/* 118 is the key [ASDCP::KeyLen bytes] */
- add_key (optional<string>(), key_id, Key (p), cpl_id);
+ add_key (optional<string>(), key_id, Key (p), cpl_id, INTEROP);
break;
}
case 138:
@@ -192,7 +192,7 @@ DecryptedKDM::DecryptedKDM (EncryptedKDM const & kdm, string private_key)
/* 97 is not-valid-after (a string) [25 bytes] */
p += 25;
/* 112 is the key [ASDCP::KeyLen bytes] */
- add_key (key_type, key_id, Key (p), cpl_id);
+ add_key (key_type, key_id, Key (p), cpl_id, SMPTE);
break;
}
default:
@@ -242,7 +242,7 @@ DecryptedKDM::DecryptedKDM (
, _issue_date (issue_date)
{
for (map<shared_ptr<const ReelMXF>, Key>::const_iterator i = keys.begin(); i != keys.end(); ++i) {
- add_key (i->first->key_type(), i->first->key_id().get(), i->second, cpl_id);
+ add_key (i->first->key_type(), i->first->key_id().get(), i->second, cpl_id, SMPTE);
}
}
@@ -266,7 +266,7 @@ DecryptedKDM::DecryptedKDM (
BOOST_FOREACH(shared_ptr<const ReelAsset> i, cpl->reel_assets ()) {
shared_ptr<const ReelMXF> mxf = boost::dynamic_pointer_cast<const ReelMXF> (i);
if (mxf && mxf->key_id ()) {
- add_key (mxf->key_type(), mxf->key_id().get(), key, cpl->id ());
+ add_key (mxf->key_type(), mxf->key_id().get(), key, cpl->id(), SMPTE);
did_one = true;
}
}
@@ -282,9 +282,9 @@ DecryptedKDM::DecryptedKDM (
* @param cpl_id ID of CPL that the key is for.
*/
void
-DecryptedKDM::add_key (optional<string> type, string key_id, Key key, string cpl_id)
+DecryptedKDM::add_key (optional<string> type, string key_id, Key key, string cpl_id, Standard standard)
{
- _keys.push_back (DecryptedKDMKey (type, key_id, key, cpl_id));
+ _keys.push_back (DecryptedKDMKey (type, key_id, key, cpl_id, standard));
}
void
@@ -294,7 +294,9 @@ DecryptedKDM::add_key (DecryptedKDMKey key)
}
EncryptedKDM
-DecryptedKDM::encrypt (shared_ptr<const CertificateChain> signer, Certificate recipient, vector<Certificate> trusted_devices, Formulation formulation) const
+DecryptedKDM::encrypt (
+ shared_ptr<const CertificateChain> signer, Certificate recipient, vector<Certificate> trusted_devices, Formulation formulation
+ ) const
{
list<pair<string, string> > key_ids;
list<string> keys;
diff --git a/src/decrypted_kdm.h b/src/decrypted_kdm.h
index 585cc615..56529b5d 100644
--- a/src/decrypted_kdm.h
+++ b/src/decrypted_kdm.h
@@ -133,7 +133,7 @@ public:
Formulation formulation
) const;
- void add_key (boost::optional<std::string> type, std::string key_id, Key key, std::string cpl_id);
+ void add_key (boost::optional<std::string> type, std::string key_id, Key key, std::string cpl_id, Standard standard);
void add_key (DecryptedKDMKey key);
/** @return This KDM's (decrypted) keys, which could be used to decrypt assets. */
diff --git a/src/decrypted_kdm_key.cc b/src/decrypted_kdm_key.cc
index 02042d4e..40ac73e9 100644
--- a/src/decrypted_kdm_key.cc
+++ b/src/decrypted_kdm_key.cc
@@ -38,5 +38,10 @@ using namespace dcp;
bool
dcp::operator== (dcp::DecryptedKDMKey const & a, dcp::DecryptedKDMKey const & b)
{
- return a.type() == b.type() && a.id() == b.id() && a.key() == b.key() && a.cpl_id() == b.cpl_id();
+ return a.type() == b.type()
+ && a.id() == b.id()
+ && a.key() == b.key()
+ && a.cpl_id() == b.cpl_id()
+ && a.standard() == b.standard()
+ && a.signer_thumbprint() == b.signer_thumbprint();
}
diff --git a/src/decrypted_kdm_key.h b/src/decrypted_kdm_key.h
index 1e03ee0a..b98f1b2b 100644
--- a/src/decrypted_kdm_key.h
+++ b/src/decrypted_kdm_key.h
@@ -39,6 +39,7 @@
#define LIBDCP_DECRYPTED_KDM_KEY_H
#include "key.h"
+#include "types.h"
#include <boost/optional.hpp>
namespace dcp {
@@ -49,11 +50,13 @@ namespace dcp {
class DecryptedKDMKey
{
public:
- DecryptedKDMKey (boost::optional<std::string> type, std::string id, Key key, std::string cpl_id)
+ DecryptedKDMKey (boost::optional<std::string> type, std::string id, Key key, std::string cpl_id, Standard standard, std::string signer_thumbprint)
: _type (type)
, _id (id)
, _key (key)
, _cpl_id (cpl_id)
+ , _standard (standard)
+ , _signer_thumbprint (signer_thumbprint)
{}
boost::optional<std::string> type () const {
@@ -72,11 +75,21 @@ public:
return _cpl_id;
}
+ Standard standard () const {
+ return _standard;
+ }
+
+ std::string signer_thumbprint () const {
+ return _signer_thumbprint;
+ }
+
private:
boost::optional<std::string> _type;
std::string _id;
Key _key;
std::string _cpl_id;
+ Standard _standard;
+ std::string _signer_thumbprint;
};
bool operator== (DecryptedKDMKey const &, DecryptedKDMKey const &);