客户端发送的鉴权信息如下:
Digest username="103", realm="asterisk", nonce="51d89e6e", uri="sip:[email protected]", algorithm=MD5, response="e9754418dd7dbea9ba740001f8d62598"
Asterisk鉴权算法:
a1 = username:realm:secret (secret是服务器端保存的密码)
a1_hash = md5_hash(a1)
a2 = request_method:uri
a2_hash = md5_hash(a2)
resp_hash = md5_hash(a1_hash:nonce:a2_hash)
然后通过resp_hash的值和鉴权信息中的response字段值做比较
(在客户端发送如上鉴权信息之前,asterisk已经将客户端计算response值得必要信息返回,这些必要信息包括realm、nonce,其中realm="asterisk",nonce=random())