RTSP身份验证:摘要问题

时间:2013-07-03 09:42:21

标签: authentication streaming rtsp http-authentication digest-authentication

我需要将我的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

所以根据wikipedia,我尝试使用该方法进行身份验证:

//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

你能帮助我吗?

2 个答案:

答案 0 :(得分:2)

响应的计算应该是:

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"

答案 1 :(得分:0)

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

Authorization: Digest
username="user",
realm="Streaming Server",
nonce="76bfe6986d3e766424de9bd6e7d3ccc1",
uri="rtsp://192.168.33.9:1935/live/my_stream.sdp",