encryptionaessmooth-streaming

Where to put 64-bit IV in 128-bit counter block for AES-128 CTR mode, in PIFF format


The documents just don't seem to provide an answer..

Microsoft tried to explain the subject clearly, but it is still ambiguous. At least in our case.

We have an encrypted MP4 stream. It contains "SampleEncryptionBox"es or "PIFF" boxes, which contain 8-byte = 64-bit Initialization Vectors for encrypted blocks. BUT: The actual "counter block" for decrypting the "AES-128 Counter Mode"-encrypted video data is 128-bit. I don't know where exactly to put the IV in it!!

Any bit of extra knowledge will be highly appreciated.


Solution

  • Ok, I found the explanation.. It is written clearly in "ISO/IEC JTC 1/SC 29 N" document.

    If the IV_size field is 8, then its value is copied to bytes 0 to 7 of the InitializationVector and bytes 8 to 15 of the InitializationVector are set to zero. The IV_size field shall not be 0 when the IsEncrypted flag is 0x1.

    AES-ECB Mode has nothing to do with it.