예제 #1
0
 def test_MD5HashA2AuthInt(self, _algorithm='md5', _hash=md5.md5):
     """
     L{calcHA2} accepts the C{'md5'} algorithm and returns an MD5 hash of
     its arguments, including the entity hash for QOP of C{'auth-int'}.
     """
     method = 'GET'
     hentity = 'foobarbaz'
     hashA2 = calcHA2(_algorithm, method, self.uri, 'auth-int', hentity)
     a2 = '%s:%s:%s' % (method, self.uri, hentity)
     expected = _hash(a2).hexdigest()
     self.assertEqual(hashA2, expected)
예제 #2
0
 def test_MD5HashA2AuthInt(self, _algorithm='md5', _hash=md5.md5):
     """
     L{calcHA2} accepts the C{'md5'} algorithm and returns an MD5 hash of
     its arguments, including the entity hash for QOP of C{'auth-int'}.
     """
     method = 'GET'
     hentity = 'foobarbaz'
     hashA2 = calcHA2(_algorithm, method, self.uri, 'auth-int', hentity)
     a2 = '%s:%s:%s' % (method, self.uri, hentity)
     expected = _hash(a2).hexdigest()
     self.assertEqual(hashA2, expected)
예제 #3
0
    def getDigestResponse(self, challenge, ncount):
        """
        Calculate the response for the given challenge
        """
        nonce = challenge.get('nonce')
        algo = challenge.get('algorithm').lower()
        qop = challenge.get('qop')

        ha1 = calcHA1(
            algo, self.username, self.realm, self.password, nonce, self.cnonce)
        ha2 = calcHA2(algo, "GET", self.uri, qop, None)
        expected = calcResponse(ha1, ha2, algo, nonce, ncount, self.cnonce, qop)
        return expected
예제 #4
0
    def getDigestResponse(self, challenge, ncount):
        """
        Calculate the response for the given challenge
        """
        nonce = challenge.get('nonce')
        algo = challenge.get('algorithm').lower()
        qop = challenge.get('qop')

        ha1 = calcHA1(algo, self.username, self.realm, self.password, nonce,
                      self.cnonce)
        ha2 = calcHA2(algo, "GET", self.uri, qop, None)
        expected = calcResponse(ha1, ha2, algo, nonce, ncount, self.cnonce,
                                qop)
        return expected