예제 #1
0
    def load_intersect_key(self, cache_meta):
        intersect_key = cache_meta[str(self.guest_party_id)]["intersect_key"]

        mod_base = int(intersect_key["mod_base"])
        exponent = int(intersect_key["exponent"])

        ph_key = PohligHellmanCipherKey(mod_base, exponent)
        self.commutative_cipher = CryptoExecutor(ph_key)
예제 #2
0
    def load_intersect_key(self, cache_meta):
        commutative_cipher = []
        for host_party in self.host_party_id_list:
            intersect_key = cache_meta[str(host_party)]["intersect_key"]

            mod_base = int(intersect_key["mod_base"])
            exponent = int(intersect_key["exponent"])

            ph_key = PohligHellmanCipherKey(mod_base, exponent)
            commutative_cipher.append(CryptoExecutor(ph_key))

        self.commutative_cipher = commutative_cipher
    def _init_model(self, param: SecureInformationRetrievalParam):
        self._init_base_model(param)

        if self.model_param.oblivious_transfer_protocol == consts.OT_HAUCK:
            self.oblivious_transfer = HauckObliviousTransferReceiver()
        else:
            LOGGER.error("SIR only supports Hauck's OT")
            raise ValueError("SIR only supports Hauck's OT")

        if self.model_param.commutative_encryption == consts.CE_PH:
            self.commutative_cipher = CryptoExecutor(PohligHellmanCipherKey.generate_key(self.model_param.key_size))
        else:
            LOGGER.error("SIR only supports Pohlig-Hellman encryption")
            raise ValueError("SIR only supports Pohlig-Hellman encryption")
예제 #4
0
 def _generate_commutative_cipher(self):
     self.commutative_cipher = [
         CryptoExecutor(PohligHellmanCipherKey.generate_key(
             self.key_length)) for _ in self.host_party_id_list
     ]