How to serialize openfhe binfhecontext in openfhe-python

from openfhe import *
import pickle5 as pickle

Sample Program: Step 1: Set CryptoContext

cc = BinFHEContext()
file_name = ‘std1.pkl’

Writing the student object to a file using pickle

with open(file_name, ‘wb’) as file:
pickle.dump(cc, file,protocol=pickle.HIGHEST_PROTOCOL)
print(f’Object successfully saved to “{file_name}”')

Error is

TypeError Traceback (most recent call last)
Cell In[22], line 4
2 # Writing the student object to a file using pickle
3 with open(file_name, ‘wb’) as file:
----> 4 pickle.dump(cc, file,protocol=pickle.HIGHEST_PROTOCOL)
5 print(f’Object successfully saved to “{file_name}”')

TypeError: cannot pickle ‘openfhe.BinFHEContext’ object

Hi @pradeep508,

The binfhe serialization has not been added yet to the Python API for OpenFHE. See Complete BinFHEContext API · Issue #86 · openfheorg/openfhe-python · GitHub for more details.