[Ffmpeg-devel] [RFC] MXF AES decryption

Baptiste Coudurier baptiste.coudurier
Sun Feb 11 14:26:04 CET 2007


Reimar D?ffinger wrote:
> Hello,
> On Sun, Feb 11, 2007 at 01:51:53PM +0100, Baptiste Coudurier wrote:
>> Michael Niedermayer wrote:
>>> On Thu, Feb 08, 2007 at 10:15:51PM +0100, Reimar D?ffinger wrote:
>>>> On Sun, Jan 14, 2007 at 09:00:59PM +0100, Baptiste Coudurier wrote:
>>>>> Reimar D?ffinger wrote:
>>>>>> [...]
>>>>>>>> @@ -768,9 +913,16 @@
>>>>>>>>              av_log(mxf->fc, AV_LOG_INFO, "source track %d: stream %d, no descriptor found\n", source_track->track_id, st->index);
>>>>>>>>              continue;
>>>>>>>>          }
>>>>>>>> +        essence_container_ul = descriptor->essence_container_ul;
>>>>>>>> +        if (IS_KLV_KEY(essence_container_ul, mxf_encrypted_essence_container)) {
>>>>>>>> +           MXFCryptoContext *cc = mxf_find_track_cryptocontext(mxf, descriptor->linked_track_id);
>>>>>>>> +           if (cc)
>>>>>>>> +               essence_container_ul = cc->source_ul;
>>>>>>>> +           mxf->sync_key = mxf_encrypted_triplet_key;
>>>>>>>> +        }
>>>>>>> That's wrong. descriptor essence container should be original source
>>>>>>> coutainer. That file is broken. Working 100% solution must be
>>>>>>> implemented, also linked track id is optional in S377M. Yes it is
>>>>>>> complicated but a working 100% solution exists.
>>>>>> I moved the sync_key setting someplace else, so the remaining code is
>>>>>> only a hack. I hope you don't expect my to improve a hack without any
>>>>>> samples that would need it (since it's a hack I'm actually tempted to
>>>>>> just remove the linked_track_id check and DMSegment and CryptoFramework
>>>>>> parsing and just grab the source_ul from the first best CryptoContext
>>>>>> found).
>>>>>>
>>>>> Well if track count is only one, I agree that would be more convenient.
>>>> Since the problems are probably caused by an old version of the spec and
>>>> the code is needed for later per-track encryption key (if it will ever
>>>> be implemented *g*) I decided to keep it.
>>>> I fixed it to use source_track->track_id instead of
>>>> descriptor->linked_track_id though.
>>>> Does this version look again to be applied?
>>> iam fine with the changes to avformat.h, and iam not mxf maintaier so no
>>> comment about that
>> Applied.
> 
> I attached the remainder of the patch that contains functions that will
> be useful if we ever encounter files with tracks that use different
> encryption key, just for reference.

Thanks, also I was thinking of using a reverse identification, since
encrypted element contains context uid, link context uid -> track num by
essence element key, and assign correct codec. I cannot believe we need
so many hacks to find codec :/, and I guess that's why SMPTE specified
to not change container ul in descriptor.

>> Can we change av_aes_init to take const uint8_t * as key argument ?
> 
> IMO that's a good idea.
> 



-- 
Baptiste COUDURIER                              GnuPG Key Id: 0x5C1ABAAA
SMARTJOG S.A.                                    http://www.smartjog.com
Key fingerprint                 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
Phone: +33 1 49966312




More information about the ffmpeg-devel mailing list