2016-03-28 54 views
0

我遇到過需要在AES加密內部方法的情況下攔截HLS密鑰請求的響應的場景。Wowza流媒體服務器攔截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) 

當請求鍵調用。

上述所有方法都攔截了密鑰請求調用。有什麼方法可以在發送給客戶端之前攔截關鍵響應?

回答

0

雖然有一種解決方法可以使用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 

的。關鍵文件將需要位於你的Wowza安裝的鍵/目錄下,如果你的VOD文件位於子目錄中,.key文件也需要與您的VOD文件具有相同的子目錄樹。例如,如果您的VOD文件sample.mp4位於content/subdir /中,那麼您的密鑰文件將是keys/subdir/sample.mp4.key,並且您的回放URL將爲​​。然後,您可以通過查看位於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 
+0

嗯,我使用的方法'onHTTPCupertinoEncryptionKeyData試圖(HTTPStreamerSessionCupertino httpCupertinoStreamingSession,IHTTPRequest REQ,IHTTPResponse RESP,字節[] encKeyData)'雖然我觀察到WMS輸出被追加到我自定義輸出。最後,我決定採用AES-128外部方法,現在我正在處理密鑰傳送的邏輯 –