sip / digest calculation
Every one in a while, I see an unexpected 403 response to a SIP client’s
REGISTER
request. Thusfar the digest response calculation has never
been wrong, but it feels good to get that check out of the way and move
on to other possible causes.
For your enjoyment and mine, a Bourne-shell compatible shell script that
calculates (qop
-less) Digest
authentication
responses.
Download: hahacalc.sh (view)
$ hahacalc
Usage: hahacalc.sh USERNAME REALM METHOD DIGESTURI NONCE [PASSWORD] [COMPARE]
Or: hahacalc.sh METHOD < autorization_headers
Example: hahacalc.sh 123456789 itsp.com REGISTER sip:sip.itsp.com:6060 \
4f7406a80000c2f214774a48d11cc5b 9e533caff7a05904c MYPASSWORD \
f5787ba2624dfdbcf874f46425d65b53
Or: echo 'Authorization:...' | hahacalc.sh REGISTER
$ hahacalc 123456789 itsp.com REGISTER sip:sip.itsp.com:6060 4f7406a80000c2f214774a48d11cc5b9e533caff7a05904c MYPASSWORD f5787ba2624dfdbcf874f46425d65b53
A1 = 123456789:itsp.com:MYPASSWORD
HA1 = 7f3c958e155df4070204c2aa5293437f
A2 = REGISTER:sip:sip.itsp.com:6060
HA2 = 2d13f8e4f7343dbd44be6ddabf8c2c1d
RESP = f5787ba2624dfdbcf874f46425d65b53
Update 2013-06-19
Updated hahacalc
to be able to parse Authorization:
headers too. In
that mode of operation, you pass only METHOD as argument, you enter the
password on the console, and you input the SIP body through stdin.