def decrypt_their_public_factor(self, r_secret): self.r_secret = r_secret their_public_factor_mpi = \ OtrCrypt.aes_zero_ctr_crypt(r_secret, self.enc_gxmpi) calculated_hash = OtrCrypt.get_sha256_bytes(their_public_factor_mpi) if calculated_hash == self.hash_gxmpi: self.store_their_public_factor(_OT.mpi_to_int(their_public_factor_mpi)) return True else: return False
def hash_my_public_factor_mpi(self, my_keyid=None): hash_gxmpi = OtrCrypt.get_sha256_bytes(self.my_public_factor_to_mpi(my_keyid)) # RCHANGE if self.authing: self.replay.check('hash_dh_factor', hash_gxmpi) hash_gxmpi_data = _OT.bytes_to_data(hash_gxmpi) return hash_gxmpi_data