6

我需要向流媒体服务器验证我的 RTSP 流,这是挑战:

RTSP/1.0 401 Unauthorized
WWW-Authenticate: Digest realm="Streaming Server",  nonce="76bfe6986d3e766424de9bd6e7d3ccc1"
Session: 1845562184;timeout=60
Cseq: 1
...

Wirecast 成功地使用这些设置进行身份验证:

Host name : 192.168.33.9:1935/live/my_stream.sdp
location : live/my_stream.sdp
username : user
password : test

它的响应是:e1dff363b9763df0c7615429af79715c

因此,根据维基百科,我尝试使用该方法进行身份验证:

//H(data) = MD5(data)
//KD(secret, data) = H(secret:data)
//A1 = username:realm:password
//A2 = http-method:uri
//response = KD( H(A1), nonce:H(A2))

HA1 = md5("user:Streaming Server:test")
HA2 = md5("POST:live/my_stream.sdp")
RESPONSE = md5(HA1+":"+nonce+":"+HA2)

但是使用此代码,我得到响应“0963c3a7b1481523f809e6affa7e792e”和 401 Unauthorized

你能帮助我吗 ?

4

2 回答 2

7

响应的计算应为:

HA1 = md5("user:Streaming Server:test")
HA2 = md5("DESCRIBE:/live/my_stream.sdp")
RESPONSE = md5(HA1+":"+nonce+":"+HA2)

以及完整的身份验证字符串:

Authorization: Digest
username="user",
algorithm="MD5",
realm="Streaming Server",
nonce="76bfe6986d3e766424de9bd6e7d3ccc1",
uri="/live/my_stream.sdp",
response="de73283590f7ad76929d20f0d06e914b"
于 2016-05-18T16:33:55.603 回答
1

假设您的摘要方法很好,您可以尝试使用这些参数来回答:

Authorization: Digest
username="user",
realm="Streaming Server",
nonce="76bfe6986d3e766424de9bd6e7d3ccc1",
uri="rtsp://192.168.33.9:1935/live/my_stream.sdp",
于 2013-08-13T11:57:48.130 回答