projects
/
dcpomatic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
2a21917
)
swaroop: add name to ECinema KDMs and add DKDM wrapper for ECinema.
author
Carl Hetherington
<cth@carlh.net>
Mon, 13 May 2019 16:20:01 +0000
(17:20 +0100)
committer
Carl Hetherington
<cth@carlh.net>
Mon, 13 May 2019 16:20:01 +0000
(17:20 +0100)
src/lib/decrypted_ecinema_kdm.cc
patch
|
blob
|
history
src/lib/decrypted_ecinema_kdm.h
patch
|
blob
|
history
src/lib/dkdm_wrapper.cc
patch
|
blob
|
history
src/lib/dkdm_wrapper.h
patch
|
blob
|
history
src/lib/encrypted_ecinema_kdm.cc
patch
|
blob
|
history
src/lib/encrypted_ecinema_kdm.h
patch
|
blob
|
history
src/lib/wscript
patch
|
blob
|
history
src/tools/dcpomatic_ecinema.cc
patch
|
blob
|
history
diff --git
a/src/lib/decrypted_ecinema_kdm.cc
b/src/lib/decrypted_ecinema_kdm.cc
index a03004e4378eb9c7ef9355e24e66a06e008ff842..14843185fdbba008de2a56f508d0802e6f397317 100644
(file)
--- a/
src/lib/decrypted_ecinema_kdm.cc
+++ b/
src/lib/decrypted_ecinema_kdm.cc
@@
-34,8
+34,9
@@
using std::string;
using std::runtime_error;
using dcp::Certificate;
using std::runtime_error;
using dcp::Certificate;
-DecryptedECinemaKDM::DecryptedECinemaKDM (string id, dcp::Key content_key)
+DecryptedECinemaKDM::DecryptedECinemaKDM (string id,
string name,
dcp::Key content_key)
: _id (id)
: _id (id)
+ , _name (name)
, _content_key (content_key)
{
, _content_key (content_key)
{
@@
-43,6
+44,7
@@
DecryptedECinemaKDM::DecryptedECinemaKDM (string id, dcp::Key content_key)
DecryptedECinemaKDM::DecryptedECinemaKDM (EncryptedECinemaKDM kdm, string private_key)
: _id (kdm.id())
DecryptedECinemaKDM::DecryptedECinemaKDM (EncryptedECinemaKDM kdm, string private_key)
: _id (kdm.id())
+ , _name (kdm.name())
{
/* Read the private key */
{
/* Read the private key */
@@
-68,7
+70,7
@@
DecryptedECinemaKDM::DecryptedECinemaKDM (EncryptedECinemaKDM kdm, string privat
EncryptedECinemaKDM
DecryptedECinemaKDM::encrypt (Certificate recipient)
{
EncryptedECinemaKDM
DecryptedECinemaKDM::encrypt (Certificate recipient)
{
- return EncryptedECinemaKDM (_id, _content_key, recipient);
+ return EncryptedECinemaKDM (_id, _
name, _
content_key, recipient);
}
#endif
}
#endif
diff --git
a/src/lib/decrypted_ecinema_kdm.h
b/src/lib/decrypted_ecinema_kdm.h
index f61402b7bffab17f5638741197bc361f5e4436ae..0ddc256154466fe8f2f13e60d7d5c1eb101cb363 100644
(file)
--- a/
src/lib/decrypted_ecinema_kdm.h
+++ b/
src/lib/decrypted_ecinema_kdm.h
@@
-28,7
+28,7
@@
class DecryptedECinemaKDM
{
public:
class DecryptedECinemaKDM
{
public:
- DecryptedECinemaKDM (std::string id, dcp::Key content_key);
+ DecryptedECinemaKDM (std::string id,
std::string name,
dcp::Key content_key);
DecryptedECinemaKDM (EncryptedECinemaKDM kdm, std::string private_key);
EncryptedECinemaKDM encrypt (dcp::Certificate recipient);
DecryptedECinemaKDM (EncryptedECinemaKDM kdm, std::string private_key);
EncryptedECinemaKDM encrypt (dcp::Certificate recipient);
@@
-37,12
+37,17
@@
public:
return _id;
}
return _id;
}
+ std::string name () const {
+ return _name;
+ }
+
dcp::Key key () const {
return _content_key;
}
private:
std::string _id;
dcp::Key key () const {
return _content_key;
}
private:
std::string _id;
+ std::string _name;
/** unenecrypted content key */
dcp::Key _content_key;
};
/** unenecrypted content key */
dcp::Key _content_key;
};
diff --git
a/src/lib/dkdm_wrapper.cc
b/src/lib/dkdm_wrapper.cc
index 76f9217aac4a64d3b6f589aa20290511a66ddad4..0dd37b464c6db6453a1bfc2d56459b48321dca9a 100644
(file)
--- a/
src/lib/dkdm_wrapper.cc
+++ b/
src/lib/dkdm_wrapper.cc
@@
-34,6
+34,10
@@
DKDMBase::read (cxml::ConstNodePtr node)
{
if (node->name() == "DKDM") {
return shared_ptr<DKDM> (new DKDM (dcp::EncryptedKDM (node->content ())));
{
if (node->name() == "DKDM") {
return shared_ptr<DKDM> (new DKDM (dcp::EncryptedKDM (node->content ())));
+#ifdef DCPOMATIC_VARIANT_SWAROOP
+ } else if (node->name() == "ECinemaDKDM") {
+ return shared_ptr<ECinemaDKDM> (new ECinemaDKDM(EncryptedECinemaKDM(node->content())));
+#endif
} else if (node->name() == "DKDMGroup") {
shared_ptr<DKDMGroup> group (new DKDMGroup (node->string_attribute ("Name")));
BOOST_FOREACH (cxml::ConstNodePtr i, node->node_children()) {
} else if (node->name() == "DKDMGroup") {
shared_ptr<DKDMGroup> group (new DKDMGroup (node->string_attribute ("Name")));
BOOST_FOREACH (cxml::ConstNodePtr i, node->node_children()) {
@@
-60,6
+64,20
@@
DKDM::as_xml (xmlpp::Element* node) const
node->add_child("DKDM")->add_child_text (_dkdm.as_xml ());
}
node->add_child("DKDM")->add_child_text (_dkdm.as_xml ());
}
+#ifdef DCPOMATIC_VARIANT_SWAROOP
+string
+ECinemaDKDM::name () const
+{
+ return String::compose ("%1 (%2)", _dkdm.name(), _dkdm.id());
+}
+
+void
+ECinemaDKDM::as_xml (xmlpp::Element* node) const
+{
+ node->add_child("ECinemaDKDM")->add_child_text (_dkdm.as_xml());
+}
+#endif
+
void
DKDMGroup::as_xml (xmlpp::Element* node) const
{
void
DKDMGroup::as_xml (xmlpp::Element* node) const
{
diff --git
a/src/lib/dkdm_wrapper.h
b/src/lib/dkdm_wrapper.h
index 09e9d25c428c3808869fc6b20429edcc9fa73876..d828ffac2536a4298563764ae58a4c390321aa03 100644
(file)
--- a/
src/lib/dkdm_wrapper.h
+++ b/
src/lib/dkdm_wrapper.h
@@
-18,6
+18,9
@@
*/
*/
+#ifdef DCPOMATIC_VARIANT_SWAROOP
+#include "encrypted_ecinema_kdm.h"
+#endif
#include <dcp/encrypted_kdm.h>
#include <libcxml/cxml.h>
#include <boost/enable_shared_from_this.hpp>
#include <dcp/encrypted_kdm.h>
#include <libcxml/cxml.h>
#include <boost/enable_shared_from_this.hpp>
@@
-67,6
+70,26
@@
private:
dcp::EncryptedKDM _dkdm;
};
dcp::EncryptedKDM _dkdm;
};
+#ifdef DCPOMATIC_VARIANT_SWAROOP
+class ECinemaDKDM : public DKDMBase
+{
+public:
+ explicit ECinemaDKDM (EncryptedECinemaKDM k)
+ : _dkdm (k)
+ {}
+
+ std::string name () const;
+ void as_xml (xmlpp::Element *) const;
+
+ EncryptedECinemaKDM dkdm () const {
+ return _dkdm;
+ }
+
+private:
+ EncryptedECinemaKDM _dkdm;
+};
+#endif
+
class DKDMGroup : public DKDMBase
{
public:
class DKDMGroup : public DKDMBase
{
public:
diff --git
a/src/lib/encrypted_ecinema_kdm.cc
b/src/lib/encrypted_ecinema_kdm.cc
index ab9e15e858d8a1bab6851c3620a6b2bff108b780..e4e19d7fb3de57426fd4707a0763b00cb2bb1864 100644
(file)
--- a/
src/lib/encrypted_ecinema_kdm.cc
+++ b/
src/lib/encrypted_ecinema_kdm.cc
@@
-21,12
+21,14
@@
#ifdef DCPOMATIC_VARIANT_SWAROOP
#include "encrypted_ecinema_kdm.h"
#ifdef DCPOMATIC_VARIANT_SWAROOP
#include "encrypted_ecinema_kdm.h"
+#include "exceptions.h"
#include <dcp/key.h>
#include <dcp/certificate.h>
#include <dcp/util.h>
#include <libcxml/cxml.h>
#include <libxml++/libxml++.h>
#include <openssl/rsa.h>
#include <dcp/key.h>
#include <dcp/certificate.h>
#include <dcp/util.h>
#include <libcxml/cxml.h>
#include <libxml++/libxml++.h>
#include <openssl/rsa.h>
+#include <openssl/err.h>
#include <iostream>
using std::cout;
#include <iostream>
using std::cout;
@@
-34,12
+36,17
@@
using std::string;
using boost::shared_ptr;
using dcp::Certificate;
using boost::shared_ptr;
using dcp::Certificate;
-EncryptedECinemaKDM::EncryptedECinemaKDM (string id, dcp::Key content_key, Certificate recipient)
+EncryptedECinemaKDM::EncryptedECinemaKDM (string id,
string name,
dcp::Key content_key, Certificate recipient)
: _id (id)
: _id (id)
+ , _name (name)
{
RSA* rsa = recipient.public_key ();
_content_key = dcp::Data (RSA_size(rsa));
int const N = RSA_public_encrypt (content_key.length(), content_key.value(), _content_key.data().get(), rsa, RSA_PKCS1_OAEP_PADDING);
{
RSA* rsa = recipient.public_key ();
_content_key = dcp::Data (RSA_size(rsa));
int const N = RSA_public_encrypt (content_key.length(), content_key.value(), _content_key.data().get(), rsa, RSA_PKCS1_OAEP_PADDING);
+ if (N == -1) {
+ throw KDMError ("Could not encrypt ECinema KDM", ERR_error_string(ERR_get_error(), 0));
+ }
+
}
EncryptedECinemaKDM::EncryptedECinemaKDM (string xml)
}
EncryptedECinemaKDM::EncryptedECinemaKDM (string xml)
@@
-47,6
+54,7
@@
EncryptedECinemaKDM::EncryptedECinemaKDM (string xml)
cxml::Document doc ("ECinemaSecurityMessage");
doc.read_string (xml);
_id = doc.string_child ("Id");
cxml::Document doc ("ECinemaSecurityMessage");
doc.read_string (xml);
_id = doc.string_child ("Id");
+ _name = doc.string_child ("Name");
_content_key = dcp::Data (256);
int const len = dcp::base64_decode (doc.string_child("Key"), _content_key.data().get(), _content_key.size());
_content_key.set_size (len);
_content_key = dcp::Data (256);
int const len = dcp::base64_decode (doc.string_child("Key"), _content_key.data().get(), _content_key.size());
_content_key.set_size (len);
@@
-72,6
+80,7
@@
EncryptedECinemaKDM::as_xml () const
xmlpp::Document document;
xmlpp::Element* root = document.create_root_node ("ECinemaSecurityMessage");
root->add_child("Id")->add_child_text(_id);
xmlpp::Document document;
xmlpp::Element* root = document.create_root_node ("ECinemaSecurityMessage");
root->add_child("Id")->add_child_text(_id);
+ root->add_child("Name")->add_child_text(_name);
root->add_child("Key")->add_child_text(lines);
return document.write_to_string ("UTF-8");
}
root->add_child("Key")->add_child_text(lines);
return document.write_to_string ("UTF-8");
}
diff --git
a/src/lib/encrypted_ecinema_kdm.h
b/src/lib/encrypted_ecinema_kdm.h
index ece1e3161b8ab003498ad3788a4c878055a3ed8e..0bcbc4117f0bbe7172b18f6a025813193161febf 100644
(file)
--- a/
src/lib/encrypted_ecinema_kdm.h
+++ b/
src/lib/encrypted_ecinema_kdm.h
@@
-40,6
+40,10
@@
public:
return _id;
}
return _id;
}
+ std::string name () const {
+ return _name;
+ }
+
dcp::Data key () const {
return _content_key;
}
dcp::Data key () const {
return _content_key;
}
@@
-47,9
+51,10
@@
public:
private:
friend class DecryptedECinemaKDM;
private:
friend class DecryptedECinemaKDM;
- EncryptedECinemaKDM (std::string id, dcp::Key key, dcp::Certificate recipient);
+ EncryptedECinemaKDM (std::string id,
std::string name,
dcp::Key key, dcp::Certificate recipient);
std::string _id;
std::string _id;
+ std::string _name;
/** encrypted content key */
dcp::Data _content_key;
};
/** encrypted content key */
dcp::Data _content_key;
};
diff --git
a/src/lib/wscript
b/src/lib/wscript
index c5a270f6536cac8972d043f362c9984f78fdc6af..37b942400ab4f0887234f660c07cc691d0707604 100644
(file)
--- a/
src/lib/wscript
+++ b/
src/lib/wscript
@@
-77,6
+77,7
@@
sources = """
digester.cc
dkdm_wrapper.cc
dolby_cp750.cc
digester.cc
dkdm_wrapper.cc
dolby_cp750.cc
+ ecinema_screen_kdm.cc
edid.cc
emailer.cc
empty.cc
edid.cc
emailer.cc
empty.cc
diff --git
a/src/tools/dcpomatic_ecinema.cc
b/src/tools/dcpomatic_ecinema.cc
index 6c4b2a8c75808956209dfd05c36fc2599c7e3220..a0324f281aa033f40fa620adfba197365b3f56a9 100644
(file)
--- a/
src/tools/dcpomatic_ecinema.cc
+++ b/
src/tools/dcpomatic_ecinema.cc
@@
-190,7
+190,7
@@
main (int argc, char* argv[])
avformat_free_context (input_fc);
avformat_free_context (output_fc);
avformat_free_context (input_fc);
avformat_free_context (output_fc);
- DecryptedECinemaKDM decrypted_kdm (id, key);
+ DecryptedECinemaKDM decrypted_kdm (id,
output_mp4.filename().string(),
key);
EncryptedECinemaKDM encrypted_kdm = decrypted_kdm.encrypt (Config::instance()->decryption_chain()->leaf());
cout << encrypted_kdm.as_xml() << "\n";
}
EncryptedECinemaKDM encrypted_kdm = decrypted_kdm.encrypt (Config::instance()->decryption_chain()->leaf());
cout << encrypted_kdm.as_xml() << "\n";
}