Open nvidianz opened 1 year ago
Indeed that's the root cause. Would be nice to have a PR to fix it :)
I found the same problem as you when I serialize CKKS cipher in federated learning . I want to create process communication use torch.distributed.rpc, which uses deepcopy() to transfer cipher to server. I desire how to fix it.
Description
Python copy.deepcopy() throws following exception when the context is public. It only occurs when encryption type is symmetric.
How to Reproduce
Run following test and it should show the exception,
Expected Behavior
The deepcopy() should work for public context for both encryption types
System Information
Additional Context
The problem is at this line https://github.com/OpenMined/TenSEAL/blob/13486592953f82ca60502fd196016f815891e25a/tenseal/cpp/context/tensealcontext.cpp#L568
It tries to get secret_key even for public context. It should behave like
save_proto_public_key()
, not trying to save secret key when the context is public