0
我正在推动SIP摘要式身份验证。这是来自服务器的401响应。需要关于SIP摘要式身份验证的帮助
SIP/2.0 401 Unauthorized
Call-ID: [email protected]:0:0:0:0:0:0:0
CSeq: 7 REGISTER
From: "myuser" <sip:[email protected]>;tag=c41616b8
To: "myuser" <sip:[email protected]>;tag=ac7e0189ab09b4fde10c77c8597b662a.5cbe
Via: SIP/2.0/UDP 172.22.162.100:5060;branch=z9hG4bK-333333-dd5444afbd4938fe01d9e1a47ccaf139
WWW-Authenticate: Digest realm="sip2sip.info", nonce="4d417ba7bb1906c1434ba9645b35d5a84d0e71ad"
Server: SIP Thor on OpenSIPS XS 1.4.5
Content-Length: 0
根据RFC 2617代码来构建摘要响应应该是这样的(用Groovy)
def md5(user, realm, pass, method, String uri, nonce) {
def paramsDump = """md5() params
user: $user
realm: $realm
password: $pass
method: $method
uri: $uri
nonce: $nonce
"""
print paramsDump
def A1 = DigestUtils.md5Hex ("$user:$realm:$pass")
def A2 = DigestUtils.md5Hex ("$method:$uri")
def left = DigestUtils.md5Hex (A1)
def right = DigestUtils.md5Hex (A2)
DigestUtils.md5Hex ("$left:$nonce:$right")
}
md5 ('myuser',
'sip2sip.info',
'mypass',
'REGISTER',
'sip:sip2sip.info',
'4d417ba7bb1906c1434ba9645b35d5a84d0e71ad')
出于某种原因,它的产量从一个我期待不同的值(我知道的预定义值应该适用于我的帐户 - 我已经完成了SIP Communicator应用程序的一些流量嗅探)。 DigestUtils类型来自Apache Codec。有任何想法吗?
感谢您的帮助 - 你刚才救了我的一天 – nixau 2011-01-31 17:52:52