From 26f6ead44ff6bcb259c1755f91beb0a9e3eee988 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 20 Jul 2014 23:38:07 +0100 Subject: Allow loading of EncryptedKDMs from strings. --- src/encrypted_kdm.cc | 7 ++++--- src/encrypted_kdm.h | 6 +----- src/util.h | 2 +- 3 files changed, 6 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/encrypted_kdm.cc b/src/encrypted_kdm.cc index d7cdd8dd..93852fb6 100644 --- a/src/encrypted_kdm.cc +++ b/src/encrypted_kdm.cc @@ -484,10 +484,11 @@ public: } } -EncryptedKDM::EncryptedKDM (boost::filesystem::path file) - : _data (new data::EncryptedKDMData (shared_ptr (new cxml::Document ("DCinemaSecurityMessage", file)))) +EncryptedKDM::EncryptedKDM (string s) { - + shared_ptr doc (new cxml::Document ("DCinemaSecurityMessage")); + doc->read_string (s); + _data = new data::EncryptedKDMData (doc); } EncryptedKDM::EncryptedKDM ( diff --git a/src/encrypted_kdm.h b/src/encrypted_kdm.h index 0d459d5a..1fcd37f4 100644 --- a/src/encrypted_kdm.h +++ b/src/encrypted_kdm.h @@ -52,11 +52,7 @@ class Certificate; class EncryptedKDM { public: - /** Read a KDM from an XML file. - * @param file XML file to read. - */ - EncryptedKDM (boost::filesystem::path file); - + EncryptedKDM (std::string); EncryptedKDM (EncryptedKDM const & kdm); EncryptedKDM & operator= (EncryptedKDM const &); ~EncryptedKDM (); diff --git a/src/util.h b/src/util.h index d3843e3d..857f872f 100644 --- a/src/util.h +++ b/src/util.h @@ -88,7 +88,7 @@ extern void add_signer (xmlpp::Element* parent, CertificateChain const & certifi extern int base64_decode (std::string const & in, unsigned char* out, int out_length); extern boost::optional relative_to_root (boost::filesystem::path root, boost::filesystem::path file); extern FILE * fopen_boost (boost::filesystem::path, std::string); -extern std::string file_to_string (boost::filesystem::path, uintmax_t max_length = 4096); +extern std::string file_to_string (boost::filesystem::path, uintmax_t max_length = 65536); extern std::string private_key_fingerprint (std::string key); template -- cgit v1.2.3