Additional IV fix. Trim sign bit from BigInteger.toByteArray() output, if it creates a 17th byte for it. #145

This commit is contained in:
Andrey Udovenko 2014-11-18 19:36:44 -05:00
parent 15d3df6a58
commit 3cfe894b93

View file

@ -395,8 +395,9 @@ public class HlsChunkSource {
byte[] ivData = new BigInteger(iv, 16).toByteArray(); byte[] ivData = new BigInteger(iv, 16).toByteArray();
byte[] ivDataWithPadding = new byte[16]; byte[] ivDataWithPadding = new byte[16];
System.arraycopy(ivData, 0, ivDataWithPadding, ivDataWithPadding.length - ivData.length, int offset = ivData.length > 16 ? ivData.length - 16 : 0;
ivData.length); System.arraycopy(ivData, offset, ivDataWithPadding, ivDataWithPadding.length - ivData.length
+ offset, ivData.length - offset);
encryptedDataSource = new Aes128DataSource(secretKey, ivDataWithPadding, upstreamDataSource); encryptedDataSource = new Aes128DataSource(secretKey, ivDataWithPadding, upstreamDataSource);
} }