【问题标题】:Wowza Streaming Server intercept response of HLS Key RequestWowza Streaming Server 拦截 HLS 密钥请求的响应
【发布时间】:2016-07-15 14:28:27
【问题描述】:

我遇到了一个场景,在 AES 加密内部方法的情况下,需要拦截 HLS Key 请求的响应。

以下是Wowza给出的句柄

onHTTPCupertinoEncryptionKeyCreateLive(IApplicationInstance
appInstance, String streamName, byte[] encKey)

在请求直播密钥时调用(每个发布的流)

void onHTTPCupertinoEncryptionKeyCreateVOD(HTTPStreamerSessionCupertino
httpSession, byte[] encKey)

在请求视频点播密钥时调用(每个会话)

void onHTTPCupertinoEncryptionKeyData(HTTPStreamerSessionCupertino
httpSession, IHTTPRequest req, IHTTPResponse resp, byte[] encKeyData)

在请求关键数据时调用。

void onHTTPCupertinoEncryptionKeyLiveChunk(ILiveStreamPacketizer
liveStreamPacketizer, String streamName, CupertinoEncInfo encInfo, long
chunkId, int mode)

在请求直播密钥时调用(每个发布的流,每个块 - 用于旋转密钥)

void onHTTPCupertinoEncryptionKeyRequest(HTTPStreamerSessionCupertino
httpSession, IHTTPRequest req, IHTTPResponse resp)

在请求密钥时调用。

上述所有方法都会拦截密钥请求调用。有什么方法可以在密钥响应发送到客户端之前拦截它?

【问题讨论】:

    标签: java key wowza http-live-streaming


    【解决方案1】:

    虽然有一种解决方法可以使用 onHTTPCupertinoEncryptionKeyData(HTTPStreamerSessionCupertino httpCupertinoStreamingSession, IHTTPRequest req, IHTTPResponse resp, byte[] encKeyData) 方法的 resp 对象生成自定义输出,但最好的方法是使用外部方法进行 AES-128 加密。您将使用与流名称同名的 .key 文件,并包含指向您的代码的 URL,该 URL 将为解密提供密钥数据。

    .key 文件的内容类似于:

    cupertinostreaming-aes128-key: DE51A7254739C0EDF1DCE13BBB308FF0
    cupertinostreaming-aes128-url: http:/mycompany.com/security.aspx
    

    .key 文件需要位于您的 Wowza 安装的 keys/ 目录中,如果您的 VOD 文件位于子目录中,则 .key 文件也需要具有相同的子目录树您的 VOD 文件。

    例如,如果您的 VOD 文件 sample.mp4 位于 content/subdir/,那么您的密钥文件将是 keys/subdir/sample.mp4.key,而您的播放 URL 将是 http://wowzaIP:1935/vod/_definst_/mp4:subdir/sample.mp4/playlist.m3u8。然后,您可以通过查看位于 logs/wowzastreamingengine_access.log 文件中的访问日志来验证这是否有效。您应该会看到类似于以下内容的行:

    HTTPStreamerCupertinoIndexFile.init[vod/_definst_/sample.mp4]: Encrypt Cupertino stream: key: *763a url: http://192.168.1.120:1935/vod/_definst_/mp4:sample.mp4/key{bitrate}{sessionid}.m3u8key
    

    【讨论】:

    • 好吧,我已经尝试使用 onHTTPCupertinoEncryptionKeyData(HTTPStreamerSessionCupertino httpCupertinoStreamingSession, IHTTPRequest req, IHTTPResponse resp, byte[] encKeyData) 方法,尽管我观察到 wms 输出被附加到我的自定义输出中。最后我决定使用 AES-128 外部方法,现在我正在处理密钥传递的逻辑
    猜你喜欢
    • 1970-01-01
    • 2020-09-25
    • 2020-10-22
    • 1970-01-01
    • 1970-01-01
    • 2018-04-19
    • 2018-01-07
    • 2018-12-01
    • 1970-01-01
    相关资源
    最近更新 更多