# The IV for AES-128

I'm trying to understand this:

[AES_128] REQUIRES the same 16-octet Initialization Vector (IV) to be supplied when encrypting and decrypting. Varying this IV increases
the strength of the cipher.

An IV attribute on an EXT-X-KEY tag with a KEYFORMAT of "identity" specifies an Initialization Vector that can be used when decrypting
Media Segments encrypted with that Key file. IV values for AES-128
are 128-bit numbers.

An EXT-X-KEY tag with a KEYFORMAT of "identity" that does not have an IV attribute indicates that the Media Sequence Number is to be used as the IV when decrypting a Media Segment, by putting its big-endian binary representation into a 16-octet (128-bit) buffer and padding (on the left) with zeros.

From here

My question is:
The iv shuld be like this (for 10 at dec.):
000000000000000A ?
or at binary?

Thank you!

• 16 bytes (or octets, which is slightly more precise) can be represented by 32 hexadecimal digits, not 16 of course; one hex digit per nibble. – Maarten Bodewes Nov 27 '17 at 1:01

The iv shuld be like this (for 10 at dec.):
000000000000000A ?
or at binary?

The HTTP headers have to be encoded as text. So I'd assume you should provide 000000000000000A (as far I know you may not send unencoded binary values in the http header)

Reading the draft something stroke my eye:

entire resource MUST be encrypted using AES-128 CBC with PKCS7 padding

using CBC mode means the IV should be unpredictable as far I know

An EXT-X-KEY tag with a KEYFORMAT of "identity" that does not have an IV attribute indicates that the Media Sequence Number is to be used

That breaks the previous requirements for unpredictable IV and the cipher becomes easily malleable. Maybe the authors rely on SSL to mitigate this issue.

• Are you sure? I'm tring to find the IV for decription .ts files.... – Yoar Nov 24 '17 at 10:22