Fix for IV bigger than 32 bits #145

This commit is contained in:
Andrey Udovenko 2014-11-18 14:11:02 -05:00
parent 3abcefa00c
commit c57484f90a

View File

@ -393,11 +393,8 @@ public class HlsChunkSource {
byte[] secretKey = new byte[data.bytesLeft()]; byte[] secretKey = new byte[data.bytesLeft()];
data.readBytes(secretKey, 0, secretKey.length); data.readBytes(secretKey, 0, secretKey.length);
int ivParsed = Integer.parseInt(iv, 16);
String iv = String.format("%032X", ivParsed);
byte[] ivData = new BigInteger(iv, 16).toByteArray(); byte[] ivData = new BigInteger(iv, 16).toByteArray();
byte[] ivDataWithPadding = new byte[iv.length() / 2]; byte[] ivDataWithPadding = new byte[16];
System.arraycopy(ivData, 0, ivDataWithPadding, ivDataWithPadding.length - ivData.length, System.arraycopy(ivData, 0, ivDataWithPadding, ivDataWithPadding.length - ivData.length,
ivData.length); ivData.length);