我遇到了一个场景,在使用AES加密内部方法的情况下,需要拦截HLS密钥请求的响应。
下面是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)在请求密钥时调用。
上面提到的所有方法都会截获key request调用。有没有什么方法可以在键响应被发送到客户端之前拦截它?
发布于 2016-04-07 08:15:45
虽然可以使用onHTTPCupertinoEncryptionKeyData(HTTPStreamerSessionCupertino httpCupertinoStreamingSession, IHTTPRequest req, IHTTPResponse resp, byte[] encKeyData)方法的resp对象生成自定义输出,但最好的方法是使用外部方法进行AES-128加密。您可以使用与流名称同名的.key文件,并包含代码的URL,以便为解密提供密钥数据。
.key文件将包含类似以下内容的内容:
cupertinostreaming-aes128-key: DE51A7254739C0EDF1DCE13BBB308FF0
cupertinostreaming-aes128-url: http:/mycompany.com/security.aspx.key文件需要位于您的Wowza安装的.key /目录中,如果您的点播文件位于子目录中,则.key文件也需要与您的点播文件具有相同的子目录树。
然后,您可以通过查看位于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}.m3u8keyhttps://stackoverflow.com/questions/36260490
复制相似问题