[SR-Users] Digest authentication

Morten Isaksen misak at misak.dk
Tue Sep 20 19:57:38 CEST 2011


Hi,

Sorry for the slightly off topic question, but I am trying to debug a
buggy PBX and want to check if the digest information is correct.

I have this perl script.

#!/usr/bin/perl

use strict;
use Digest::MD5  qw(md5 md5_hex md5_base64);

my $uri = 'sip:sip1.uni-tel.dk';
my $method = "SIP/2.0";
my $username = "69102208";
my $password = "password";
my $nonce = "4e78d2b0a72196d9123be7c88d093bd74c77f35e";
my $realm = "sip1.uni-tel.dk";

my $a1 = "$username:$realm:$password";
my $ha1 = md5_hex($a1);

my $a2 = "$method:$uri";
my $ha2 = md5_hex($a2);

print "A1  : $a1\n";
print "A2  : $a2\n";

my $response = md5_hex("$ha1:$nonce:$ha2");

print "\nRES : $response\n\n";

I registered with a softphone and entered the above values from the
Authentication header, but I cannot get the response to match.

Any help would be appreciated.

-- 
Morten Isaksen



More information about the sr-users mailing list