play encrypted content

Jul 22, 2015 at 4:38 AM
Hi,
I have a new task in my project. I must build a media player on wp 8.1 to play HLS. Each files of HLS were encrypted and I already have the function to decrypt that files.
My solution: choose phonesm to play decrypted content, use decrypt-function to decrypt the encrypted files.
My problem: I'm newbie so I don't know how to integrate decrypt-function with phonesm source code?

My decrypt-function is very simple and it only require 2 parameter: a byte array (file content) and a key to decrypt.

Thanks.
Suco.
Coordinator
Jul 31, 2015 at 9:33 AM
You might look at how the HLS METHOD=AES-128 stuff is handled in HlsStreamSegments. It uses SubStreamSegment.AsyncStreamFilter to decrypt each HLS segment. That code is a bit clunky since it was bolted on after the fact.

If your application also encrypts the playlists, then you would probably be better off looking at sub-classing one of the IWebReader/IWebReaderManager implementations.

Without knowing more about what you need to decrypt, it is difficult to be more specific.
Aug 3, 2015 at 10:25 AM
Thanks for your reply.

Our content server didn't encrypt the playlists, it's clear text file. Only .ts files were encrypted by METHOD=AES-128. So, what should I do next?

Thanks.
Suco.
Aug 3, 2015 at 10:44 AM
Edited Aug 3, 2015 at 10:47 AM
Here is some information:
Content of media url:
#EXTM3U
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=434656,CODECS="avc1.42e00a"
141_0.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=703872,CODECS="avc1.4d400a"
141_1.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1306976,CODECS="avc1.42e00a"
141_2.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=2613952,CODECS="avc1.42e00a"
141_3.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=5125632,CODECS="avc1.42e00a"
141_4.m3u8
Content of 141_0.m3u8 file:
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:7
#EXT-X-MEDIA-SEQUENCE:125864
#EXT-X-KEY:METHOD=AES-128,URI="CAB/keyfile?r=141",IV=0x00000000000000000000000000000000
#EXTINF:6,
141_0_0.ts
#EXTINF:6,
141_0_1.ts
#EXTINF:6,
141_0_2.ts
#EXTINF:6,
141_0_3.ts
#EXTINF:6,
141_0_4.ts
#EXTINF:6,
141_0_5.ts
#EXTINF:6,
141_0_6.ts
#EXTINF:6,
141_0_7.ts
#EXTINF:6,
141_0_8.ts
#EXTINF:6,
141_0_9.ts