rtsp摘要认证协议(Response计算方法)

rtsp摘要认证协议(Response计算方法)

 

说明:

例如:OPTIONS rtsp://192.168.123.158:554/11RTSP/1.0

 

RTSP客户端应该使用username + password并计算response如下:

(1)passwordMD5编码,

   response = md5(password:nonce:md5(public_method:url));

(2)passwordANSI字符串,

    response= md5(md5(username:realm:password):nonce:md5(public_method:url));

客户端在每次发起不同的请求方法时都需要计算response字段,同样在服务器端校验时也默认采取同样的计算方法。

OPTIONS rtsp://10.15.3.199:554/ch1/main/av_stream RTSP/1.0
CSeq: 2
User-Agent: LibVLC/2.2.0 (LIVE555 Streaming Media v2014.07.25)

RTSP/1.0 401 Unauthorized
CSeq: 2
WWW-Authenticate: Digest realm="Hikvision", nonce="78f40f2c57eee727a4be179049cecf89", random="+FeTGE9jY6DXLFwxbn0zJ4/iHBPwBt2qFko+pe2glxvlzc6XEqkODju95yt+3Ajl", stale="FALSE"
WWW-Authenticate: Basic realm="/"

OPTIONS rtsp://10.15.3.199:554/ch1/main/av_stream RTSP/1.0
CSeq: 3
Authorization: Digest username="admin", realm="Hikvision", nonce="78f40f2c57eee727a4be179049cecf89", uri="rtsp://10.15.3.199:554/ch1/main/av_stream", response="2b5b3a02f3a4bd3031a3fba092e25400"
User-Agent: LibVLC/2.2.0 (LIVE555 Streaming Media v2014.07.25)

RTSP/1.0 200 OK
CSeq: 3
Public: OPTIONS, DESCRIBE, SETUP, TEARDOWN, PLAY, PAUSE

 注意:url是其中明确指定的uri(即uri="rtsp://10.15.3.199:554/ch1/main/av_stream",若uri="/ch1/main/av_stream",则url="/ch1/main/av_stream")

posted @ 2016-07-15 12:15  静之深  阅读(1940)  评论(0编辑  收藏  举报