Closed lidh15 closed 2 years ago
Sorry for the reply late, could you demonstrate the code? I tried your code in windows10 and ubuntu20, and there is no problem.
from seal import *
from seal_helper import *
import pickle
parms = EncryptionParameters(scheme_type.bfv)
poly_modulus_degree = 8192
parms.set_poly_modulus_degree(poly_modulus_degree)
parms.set_coeff_modulus(CoeffModulus.Create(8192, [60, 40, 40, 60]))
parms.set_plain_modulus(PlainModulus.Batching(8192, 20))
context = SEALContext(parms)
keygen = KeyGenerator(context)
sk = keygen.secret_key()
pk = keygen.create_public_key()
encryptor = Encryptor(context, pk)
evaluator = Evaluator(context)
decryptor = Decryptor(context, sk)
x_plain = Plaintext(str(3))
x_encrypted = encryptor.encrypt(x_plain)
x_encrypted2 = Ciphertext(x_encrypted)
evaluator.add_inplace(x_encrypted, x_encrypted)
res1 = decryptor.invariant_noise_budget(x_encrypted)
print(res1) # 111
sk.set_parms(parms)
print(sk) # <seal.SecretKey object at 0x000002055B0A1470>
sk1 = pickle.dumps(sk)
print(len(sk1)) # 349891
sk2 = pickle.loads(sk1)
print(sk2) # <seal.SecretKey object at 0x000002055B1B89F0>
decryptor2 = Decryptor(context, sk2)
res2 = decryptor.invariant_noise_budget(x_encrypted)
print(res2) # 111
Hava you rebuild the SEAL lib after running the py helper.py
?
I tried your demo code, yes there is no segmentation fault. In fact I only see the error in certain functions in my codes, this is strange and I think I need some more time to figure out what happened.
[//]: # Before submitting this issue, make sure you have already searched and still have problems. Describe the bug A clear and concise description of what the bug is.
Device\Environment System: Ubuntu18.04 Python: 3.8.5
To Reproduce Steps to reproduce the behavior:
Expected behavior A clear and concise description of what you expected to happen.