2

I have been working on Wowza Streaming Server and while trying to secure Apple HTTP Live Streaming using AES-128 - external method I am encountering below problems :

  1. External AES-128 method of encryption is not working for .smil files present in the sub-folder of the application's source directory. I tried to achieve it by putting the [my-stream].key in [install-dir]/keys and [install-dir]/keys/[sub-folder-name] but both the scenarios failed for me to achieve this.

playlist url is :- [wowza-server-ip]:[port]/[application-name]/[applcation-instance-name]/smil:[sub-folder]/demo.smil/playlist.m3u8

  1. In case of mp4s present in the application's source path, the player is not calling the key url.

The sequence of calls made by the player are :-

  • [wowza-server-ip]:[port]/crossdomain.xml
  • [wowza-server-ip]:[port]/[application-name]/[applcation-instance-name]/[stream-name]/playlist.m3u8
  • [wowza-server-ip]:[port]/[application-name]/[applcation-instance-name]/[stream-name]/chunklist_w[wowza-session-id].m3u8
  • [web-server-ip]:[port]/crossdomain.xml

After this player is not calling the "key request uri" as it was supposed to call. The calls are going properly when I am using the internal AES-128 method of Encryption.

My chunklist_w[wowza-session-id].m3u8 is

#EXTM3U

#EXT-X-VERSION:3

#EXT-X-TARGETDURATION:12

#EXT-X-MEDIA-SEQUENCE:0

#EXT-X-KEY:METHOD=AES-128,URI="http://[web-server-ip]:[port]/SimpleWebServlet/key.jsp?wowzasessionid=[session-id]"

#EXTINF:9.52,

media_w[session-id]_0.ts

#EXTINF:10.4,

media_w[session-id]_1.ts

[streamname].key file in [install-dir]/keys folder is

cupertinostreaming-aes128-key: DE51A7254739C0EDF1DCE13BBB308FF0

cupertinostreaming-aes128-url: http://[web-server-ip]:[port]/SimpleWebServlet/key.jsp

jsp file to return the key is key.jsp

<%@ page import="java.util.*,java.io.*" %>
<%
boolean isValid = true;
if (!isValid)
{
    response.setStatus( 403 );
}
else
{
    response.setHeader("Content-Type", "binary/octet-stream");
    response.setHeader("Pragma", "no-cache");

    String keyStr = "DE51A7254739C0EDF1DCE13BBB308FF0";

    int len = keyStr.length()/2;
    byte[] keyBuffer = new byte[len];  

    for (int i=0;i<len;i++)
        keyBuffer[i] = (byte)Integer.parseInt(keyStr.substring(i*2, (i*2)+2), 16);

    OutputStream outs = response.getOutputStream();
    outs.write(keyBuffer);
    outs.flush();
}
%>

If anybody has encountered the similar problem or has successfully implemented the external aes-128 method of wowza, kindly put some light on the issues mentioned above.

EDIT 1

Kindly ignore the 2nd point as after further analysis I found out that there is some issue with the jboss delivering the key, once it delivers the crossdomain xml to the player.

For reference to this problem kindly check : Can I call two crossdomain.xml from two different servers from my flash player?

EDIT 2

Apologies for the typo in my first point. It should be .smil rather than .mp4, I have corrected the same in my first point

Community
  • 1
  • 1
saurabh kedia
  • 321
  • 2
  • 11

1 Answers1

0

I recently tried out HLS with AES128 and it worked fine. My key file was in [wowzadir]/keys/mystream.key. Looks like it is your player that does not do something right here. Which player are you using?

You can try to use wget to download some chunks and you can inspect them with VLC for example to see if the encryption was applied.

jabal
  • 11,987
  • 12
  • 51
  • 99
  • HLS with external AES128 is working fine when I put the [stream-name].key in [wowza-install-dir]/keys for MP4s, but the same is encountering problem when I am trying with SMIL files, for ABR streaming. I have verified the chunkllist.m3u8 and .ts file to ensure whether they are encrypted or not. – saurabh kedia Mar 30 '16 at 18:57
  • @saurabhkedia Were you able to figure out how to get SMIL files to work with Wowza's AES-128 external method ? I'm in a similar situation and would like to know if you were successful. If yes, can you please post it as an answer here ? Thanks. – ami91 Sep 22 '16 at 16:18
  • @ami91 Yes I have got the way to use the internal as well as external AES-128 methods of Wowza Change the path in application config xml in keyDir tag present under Streams tag, to the path where your key files will be present. Maintain the same directory structure if you are using subfolders inside the wowza application's base folder for the mp4. Note : Your key name should be your mp4's filename .key. ex - For Test.mp4 you need to have Test.mp4.key as the key file name. Hope that helps in resolving your issue, if not kindly mention the issue in detail. – saurabh kedia Sep 28 '16 at 13:42