summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2016-10-31 11:32:04 +0000
committerCarl Hetherington <cth@carlh.net>2016-10-31 11:32:04 +0000
commitd23e6e10c55d0558d0d5b34d8cde0e12c0297550 (patch)
tree9aa3b3ad01985d026e69ee6a6d60f65354f71f1b /src
parent079d5cae5c0dfbbd5b683c4e7148119de5f9b47d (diff)
Allow configuration of context ID used when encrypting MXFs.
Diffstat (limited to 'src')
-rw-r--r--src/mxf.cc8
-rw-r--r--src/mxf.h14
2 files changed, 21 insertions, 1 deletions
diff --git a/src/mxf.cc b/src/mxf.cc
index 6ec634da..03e3d1d8 100644
--- a/src/mxf.cc
+++ b/src/mxf.cc
@@ -57,6 +57,12 @@ using boost::shared_ptr;
using boost::dynamic_pointer_cast;
using namespace dcp;
+MXF::MXF ()
+ : _context_id (make_uuid ())
+{
+
+}
+
void
MXF::fill_writer_info (ASDCP::WriterInfo* writer_info, string id, Standard standard) const
{
@@ -76,7 +82,7 @@ MXF::fill_writer_info (ASDCP::WriterInfo* writer_info, string id, Standard stand
writer_info->UsesHMAC = true;
if (_key_id) {
- Kumu::GenRandomUUID (writer_info->ContextID);
+ Kumu::hex2bin (_context_id.c_str(), writer_info->ContextID, Kumu::UUID_Length, &c);
writer_info->EncryptedEssence = true;
unsigned int c;
diff --git a/src/mxf.h b/src/mxf.h
index 73ada433..52d335ea 100644
--- a/src/mxf.h
+++ b/src/mxf.h
@@ -61,6 +61,7 @@ class PictureAssetWriter;
class MXF
{
public:
+ MXF ();
virtual ~MXF () {}
/** @return true if the data is encrypted */
@@ -87,6 +88,18 @@ public:
return _key;
}
+ /** Set the context ID to be used when encrypting.
+ * @param id New ID.
+ */
+ void set_context_id (std::string id) {
+ _context_id = id;
+ }
+
+ /** @return context ID used when encrypting; this starts off as a random value */
+ std::string context_id () const {
+ return _context_id;
+ }
+
/** Set the metadata that is written to the MXF file.
* @param m Metadata.
*/
@@ -114,6 +127,7 @@ protected:
boost::optional<std::string> _key_id;
/** Key used for encryption/decryption, if there is one */
boost::optional<Key> _key;
+ std::string _context_id;
MXFMetadata _metadata;
};