RTSP 身份验证:摘要问题

Pie*_*e D 6 authentication streaming http-authentication rtsp digest-authentication

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

RTSP/1.0 401 Unauthorized
WWW-Authenticate: Digest realm="Streaming Server",  nonce="76bfe6986d3e766424de9bd6e7d3ccc1"
Session: 1845562184;timeout=60
Cseq: 1
...
Run Code Online (Sandbox Code Playgroud)

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

Host name : 192.168.33.9:1935/live/my_stream.sdp
location : live/my_stream.sdp
username : user
password : test
Run Code Online (Sandbox Code Playgroud)

它的响应是: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)
Run Code Online (Sandbox Code Playgroud)

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

你能帮助我吗 ?

小智 6

响应的计算应该是:

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

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

Authorization: Digest
username="user",
algorithm="MD5",
realm="Streaming Server",
nonce="76bfe6986d3e766424de9bd6e7d3ccc1",
uri="/live/my_stream.sdp",
response="de73283590f7ad76929d20f0d06e914b"
Run Code Online (Sandbox Code Playgroud)


Han*_*eTV 1

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

Authorization: Digest
username="user",
realm="Streaming Server",
nonce="76bfe6986d3e766424de9bd6e7d3ccc1",
uri="/live/my_stream.sdp",
Run Code Online (Sandbox Code Playgroud)