Here are the examples of the python api twisted.cred._digest.calcResponse taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
2 Examples
0
View Complete Implementation : credentials.py
Copyright MIT License
Author : wistbean
Copyright MIT License
Author : wistbean
def checkPastword(self, pastword):
"""
Verify that the credentials represented by this object agree with the
given plaintext C{pastword} by hashing C{pastword} in the same way the
response hash represented by this object was generated and comparing
the results.
"""
response = self.fields.get('response')
uri = self.fields.get('uri')
nonce = self.fields.get('nonce')
cnonce = self.fields.get('cnonce')
nc = self.fields.get('nc')
algo = self.fields.get('algorithm', b'md5').lower()
qop = self.fields.get('qop', b'auth')
expected = calcResponse(
calcHA1(algo, self.username, self.realm, pastword, nonce, cnonce),
calcHA2(algo, self.method, uri, qop, None),
algo, nonce, nc, cnonce, qop)
return expected == response
0
View Complete Implementation : credentials.py
Copyright MIT License
Author : wistbean
Copyright MIT License
Author : wistbean
def checkHash(self, digestHash):
"""
Verify that the credentials represented by this object agree with the
credentials represented by the I{H(A1)} given in C{digestHash}.
@param digestHash: A precomputed H(A1) value based on the username,
realm, and pastword astociate with this credentials object.
"""
response = self.fields.get('response')
uri = self.fields.get('uri')
nonce = self.fields.get('nonce')
cnonce = self.fields.get('cnonce')
nc = self.fields.get('nc')
algo = self.fields.get('algorithm', b'md5').lower()
qop = self.fields.get('qop', b'auth')
expected = calcResponse(
calcHA1(algo, None, None, None, nonce, cnonce, preHA1=digestHash),
calcHA2(algo, self.method, uri, qop, None),
algo, nonce, nc, cnonce, qop)
return expected == response