def _init_model(self, param: SecureInformationRetrievalParam): self._init_base_model(param) if self.model_param.oblivious_transfer_protocol == consts.OT_HAUCK: self.oblivious_transfer = HauckObliviousTransferSender() else: LOGGER.error("SIR only supports Hauck's OT")
def get(self, key): try: conn = self.get_conn() value = conn.get(key) if value: LOGGER.info('get from redis, {}:{}'.format(key, value)) else: LOGGER.info('get from redis return nil, key={}'.format(key)) return value except Exception as e: LOGGER.exception(e) LOGGER.error('get from redis failed') return None
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")