Esempio n. 1
0
 def check_blob_signatures():
     for blob in blobs:
         length = blob['length']
         if length != 0:
             blob_hash = blob['blob_hash']
         else:
             blob_hash = None
         blob_num = blob['blob_num']
         revision = blob['revision']
         iv = blob['iv']
         signature = blob['signature']
         hashsum = get_lbry_hash_obj()
         hashsum.update(stream_hash)
         if length != 0:
             hashsum.update(blob_hash)
         hashsum.update(str(blob_num))
         hashsum.update(str(revision))
         hashsum.update(iv)
         hashsum.update(str(length))
         if not verify_signature(hashsum.digest(), signature, public_key):
             raise InvalidStreamDescriptorError("Invalid signature in stream descriptor")
Esempio n. 2
0
 def _verify_blob(self, blob):
     log.debug("Got an unverified blob to check:")
     log.debug("blob_hash: %s", blob.blob_hash)
     log.debug("blob_num: %s", str(blob.blob_num))
     log.debug("revision: %s", str(blob.revision))
     log.debug("iv: %s", blob.iv)
     log.debug("length: %s", str(blob.length))
     hashsum = get_lbry_hash_obj()
     hashsum.update(self.stream_hash)
     if blob.length != 0:
         hashsum.update(blob.blob_hash)
     hashsum.update(str(blob.blob_num))
     hashsum.update(str(blob.revision))
     hashsum.update(blob.iv)
     hashsum.update(str(blob.length))
     log.debug("hexdigest to be verified: %s", hashsum.hexdigest())
     if verify_signature(hashsum.digest(), blob.signature, self.stream_pub_key):
         log.debug("Blob info is valid")
         return True
     else:
         log.debug("The blob info is invalid")
         return False
 def _verify_blob(self, blob):
     log.debug("Got an unverified blob to check:")
     log.debug("blob_hash: %s", blob.blob_hash)
     log.debug("blob_num: %s", str(blob.blob_num))
     log.debug("revision: %s", str(blob.revision))
     log.debug("iv: %s", blob.iv)
     log.debug("length: %s", str(blob.length))
     hashsum = get_lbry_hash_obj()
     hashsum.update(self.stream_hash)
     if blob.length != 0:
         hashsum.update(blob.blob_hash)
     hashsum.update(str(blob.blob_num))
     hashsum.update(str(blob.revision))
     hashsum.update(blob.iv)
     hashsum.update(str(blob.length))
     log.debug("hexdigest to be verified: %s", hashsum.hexdigest())
     if verify_signature(hashsum.digest(), blob.signature,
                         self.stream_pub_key):
         log.debug("Blob info is valid")
         return True
     else:
         log.debug("The blob info is invalid")
         return False