示例#1
0
 def current_hmac(self, cached = False):
     """Returns the current hmac of self.fulldata"""
     data = ''
     for i in self.headers:
         log.debug("Adding hmac data %s", repr(i.hmac_data()))
         if cached:
             data += i.data
         else:
             data += i.hmac_data()
     for i in self.records:
         log.debug("Adding hmac data %s", repr(i.hmac_data()))
         data += i.hmac_data()
     log.debug("Building hmac with key %s", repr(self.hshkey))
     hm = HMAC(self.hshkey, data, sha256_mod)
     #print hm.hexdigest()
     log.debug("HMAC %s-%s", repr(hm.hexdigest()), repr(hm.digest()))
     return hm.digest()
示例#2
0
 def current_hmac(self, cached=False):
     """Returns the current hmac of self.fulldata"""
     data = ''
     for i in self.headers:
         log.debug("Adding hmac data %s", repr(i.hmac_data()))
         if cached:
             data += i.data
         else:
             data += i.hmac_data()
     for i in self.records:
         log.debug("Adding hmac data %s", repr(i.hmac_data()))
         data += i.hmac_data()
     log.debug("Building hmac with key %s", repr(self.hshkey))
     hm = HMAC(self.hshkey, data, sha256_mod)
     #print hm.hexdigest()
     log.debug("HMAC %s-%s", repr(hm.hexdigest()), repr(hm.digest()))
     return hm.digest()
示例#3
0
 def current_hmac(self, cached = False):
     """Returns the current hmac of self.fulldata"""
     data = ''
     for i in self.headers:
         log.debug("Adding hmac data %r from %r" % (i.hmac_data(), i.__class__.__name__))
         if cached:
             data += i.data
         else:
             data += i.hmac_data()
             # assert i.data == i.hmac_data(), "Working on %r where %r!=%r" % (i, i.data, i.hmac_data())
     for i in self.records:
         # TODO: Add caching support
         log.debug("Adding hmac data %r from %r" % (i.hmac_data(), i.__class__.__name__))
         data += i.hmac_data()
     log.debug("Building hmac with key %s", repr(self.hshkey))
     hm = HMAC(self.hshkey, data, sha256_mod)
     # print hm.hexdigest()
     log.debug("HMAC %s-%s", repr(hm.hexdigest()), repr(hm.digest()))
     return hm.digest()
示例#4
0
 def current_hmac(self, cached=False):
     """Returns the current hmac of self.fulldata"""
     data = b''
     for i in self.headers:
         log.debug("Adding hmac data %r from %r" %
                   (i.hmac_data(), i.__class__.__name__))
         if cached:
             data += i.data
         else:
             data += i.hmac_data()
             # assert i.data == i.hmac_data(), "Working on %r where %r!=%r" % (i, i.data, i.hmac_data())
     for i in self.records:
         # TODO: Add caching support
         log.debug("Adding hmac data %r from %r" %
                   (i.hmac_data(), i.__class__.__name__))
         data += i.hmac_data()
     log.debug("Building hmac with key %s", repr(self.hshkey))
     hm = HMAC(self.hshkey, data, sha256_mod)
     # print hm.hexdigest()
     log.debug("HMAC %s-%s", repr(hm.hexdigest()), repr(hm.digest()))
     return hm.digest()