Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RTSP Authentication : digest issue

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 ?

like image 380
Pierre D Avatar asked Jul 03 '13 09:07

Pierre D


1 Answers

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"
like image 164
crayfishapps Avatar answered Sep 30 '22 15:09

crayfishapps