'Validate the nonce.
Returns True if nonce was generated by synthesize_nonce() and the
timestamp is not spoofed, else returns False.
s
A string related to the resource, such as the hostname of
the server.
key
A secret string known only to the server.
Both s and key must be the same values which were used to synthesize
the nonce we are trying to validate.'

def validate_nonce(self, s, key):

    try:
        (timestamp, hashpart) = self.nonce.split(':', 1)
        (s_timestamp, s_hashpart) = synthesize_nonce(s, key, timestamp).split(':', 1)
        is_valid = (s_hashpart == hashpart)
        if self.debug:
            TRACE(('validate_nonce:    %s' % is_valid))
        return is_valid
    except ValueError:
        pass
    return False
