def _ValidateResponseObject(response, response_text): if not response_text: return our_hmac = CreateHmac(response_text, BaseRequest.hmac_secret) their_hmac = ToBytes(b64decode(response.headers[_HMAC_HEADER])) if not compare_digest(our_hmac, their_hmac): raise RuntimeError('Received invalid HMAC for response!')
def _ContentHmacValid(self, response): our_hmac = CreateHmac(response.content, self._hmac_secret) their_hmac = ToBytes(b64decode(response.headers[HMAC_HEADER])) return SecureBytesEqual(our_hmac, their_hmac)
def _ValidateResponseObject(response): our_hmac = CreateHmac(response.content, BaseRequest.hmac_secret) their_hmac = ToBytes(b64decode(response.headers[_HMAC_HEADER])) if not SecureBytesEqual(our_hmac, their_hmac): raise RuntimeError('Received invalid HMAC for response!') return True
def _ValidateResponseObject( response ): hmac = CreateHmac( response.content, BaseRequest.hmac_secret ) if not SecureStringsEqual( hmac, b64decode( response.headers[ _HMAC_HEADER ] ) ): raise RuntimeError( 'Received invalid HMAC for response!' ) return True