We are using openssl aes-128 encryption for streaming media on HLS video streaming for Apple.
Below is the command used for the aes-128 encryption
openssl aes-128-cbc -salt -k <HEXKey> -iv <HEXIV> -in <INFILE> -out <OUTFILE>
And below in my Playlist / Index File being used for hls streaming.
#EXTM3U
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-ALLOW-CACHE:NO
#EXT-X-VERSION:2
#EXT-X-KEY:METHOD=AES-128,URI="http://xxx.xxxx.xxx/key.txt",IV=0x00000000000000000000000000000000
#EXT-X-TARGETDURATION:10
#EXTINF:10,
http://xxx.xxxx.xxx/encry.ts
#EXT-X-ENDLIST
Where , key.txt contains the hex key as of form 0x00000000000000000000000000000000.
But this is not working and not playing media on IOS device. provides error as This movie could not be played
I am not sure , what is wrong in it. Is this issue of encryption method or playlist file
Please help me. I’ll Appreciate.
Thanks in Advance
EDIT :
I Felt , below few information, may help if anything wrong in that.
Below is command I use for creating hex key and IV
openssl enc -aes-128-cbc -k String@MyKey -P -md sha1
Please help me if anything wrong with it.
now my playlist file parsing fine with Media Stream Validator , but while validating media it gives below error.
unable to parse segment due to encryption
Please help anybody.
Your problem is actually with the file ‘key.txt’. The HLS specs say that the URI attribute within the #EXT-X-KEY tag must point to a file with an array of the 16 octets in binary format, not the hex string that you are providing.
For more info see: https://datatracker.ietf.org/doc/html/draft-pantos-http-live-streaming-10#section-5