Ejemplo n.º 1
0
def test_get_sufficient_sk_power(poly_mod, coeff_mod, plain_mod, sk, max_power,
                                 result):
    ctx = Context(EncryptionParams(poly_mod, coeff_mod, plain_mod))
    sk = SecretKey(sk)
    decrypter = Decryptor(ctx, sk)
    output = decrypter._get_sufficient_sk_power(max_power)
    assert output == result
Ejemplo n.º 2
0
 def _generate_sk(self):
     param = self.context.context_data_map[self.context.key_param_id].param
     self.secret_key = SecretKey(sample_poly_ternary(param))
Ejemplo n.º 3
0
    def _generate_sk(self, is_initialized=False):
        param = self._context.param

        if not is_initialized:
            self._secret_key = SecretKey(sample_poly_ternary(param))
Ejemplo n.º 4
0
def test_mul_ct_sk(poly_mod, coeff_mod, plain_mod, sk, ct, result):
    ctx = Context(EncryptionParams(poly_mod, coeff_mod, plain_mod))
    sk = SecretKey(sk)
    decrypter = Decryptor(ctx, sk)
    output = decrypter._mul_ct_sk(ct)
    assert output == result