X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fmxf.cc;h=260e270efc6df6d2dea8895bcf92e9ea43cdd899;hb=f0a6d7b5b8d16b8b47917cd30b340917f5c62fc5;hp=80a351e60d19b72360fb8b40a3dec10d45b82908;hpb=7b717db244554300ebed8eade8421ee3faa28d33;p=libdcp.git diff --git a/src/mxf.cc b/src/mxf.cc index 80a351e6..260e270e 100644 --- a/src/mxf.cc +++ b/src/mxf.cc @@ -36,6 +36,7 @@ #include using std::string; +using std::cout; using std::list; using std::pair; using boost::shared_ptr; @@ -54,7 +55,7 @@ MXF::~MXF () } void -MXF::fill_writer_info (ASDCP::WriterInfo* writer_info, string id, Standard standard) +MXF::fill_writer_info (ASDCP::WriterInfo* writer_info, string id, Standard standard) const { writer_info->ProductVersion = _metadata.product_version; writer_info->CompanyName = _metadata.company_name; @@ -69,6 +70,8 @@ MXF::fill_writer_info (ASDCP::WriterInfo* writer_info, string id, Standard stand Kumu::hex2bin (id.c_str(), writer_info->AssetUUID, Kumu::UUID_Length, &c); DCP_ASSERT (c == Kumu::UUID_Length); + writer_info->UsesHMAC = true; + if (_key_id) { Kumu::GenRandomUUID (writer_info->ContextID); writer_info->EncryptedEssence = true; @@ -93,7 +96,7 @@ MXF::set_key (Key key) /* No key ID so far; we now need one */ _key_id = make_uuid (); } - + _decryption_context = new ASDCP::AESDecContext; if (ASDCP_FAILURE (_decryption_context->InitKey (_key->value ()))) { throw MiscError ("could not set up decryption context"); @@ -105,11 +108,13 @@ MXF::read_writer_info (ASDCP::WriterInfo const & info) { char buffer[64]; - Kumu::bin2UUIDhex (info.CryptographicKeyID, ASDCP::UUIDlen, buffer, sizeof (buffer)); - _key_id = buffer; + if (info.EncryptedEssence) { + Kumu::bin2UUIDhex (info.CryptographicKeyID, ASDCP::UUIDlen, buffer, sizeof (buffer)); + _key_id = buffer; + } _metadata.read (info); - + Kumu::bin2UUIDhex (info.AssetUUID, ASDCP::UUIDlen, buffer, sizeof (buffer)); return buffer; }