Ejemplo n.º 1
0
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!')
Ejemplo n.º 2
0
 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)
Ejemplo n.º 3
0
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
Ejemplo n.º 4
0
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