예제 #1
0
파일: client_test.py 프로젝트: ctomiao2/vim
 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)
예제 #2
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