RTSP Authentication : digest issue

泪湿孤枕 提交于 2019-12-21 20:29:38

问题


I need to authenticate my RTSP stream to a streaming server, here is the challenge :

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

Wirecast manage to successfully authenticate with those settings :

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

its response is : e1dff363b9763df0c7615429af79715c

So according to wikipedia I tried to authenticate with the method :

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

but with this code I get the response "0963c3a7b1481523f809e6affa7e792e" and 401 Unauthorized

Can you help me ?


回答1:


Assuming your digest method is fine you can try to answer with those parameters :

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



回答2:


The calculation of the response should be:

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

And the complete authentication string:

Authorization: Digest
username="user",
algorithm="MD5",
realm="Streaming Server",
nonce="76bfe6986d3e766424de9bd6e7d3ccc1",
uri="/live/my_stream.sdp",
response="de73283590f7ad76929d20f0d06e914b"


来源:https://stackoverflow.com/questions/17444635/rtsp-authentication-digest-issue

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!