Hi!
I've discovered an issue with key's serialization for BFV scheme. The issue was discovered using openfhe-python, but it looks like a problem in openfhe library.
The issue was found in the following source code
parameters = CCParamsBFVRNS()
parameters.SetPlaintextModulus(params.plaintext_modulus)
parameters.SetMultiplicativeDepth(params.mult_depth)
parameters.SetMaxRelinSkDeg(params.max_relin_sk_deg)
cc = GenCryptoContext(parameters)
cc.Enable(PKESchemeFeature.PKE)
cc.Enable(PKESchemeFeature.KEYSWITCH)
cc.Enable(PKESchemeFeature.LEVELEDSHE)
cc.Enable(PKESchemeFeature.ADVANCEDSHE)
cc.Enable(PKESchemeFeature.FHE)
key_pair = cc.KeyGen()
if not SerializeToFile(crypto_params["key_pub"], key_pair.publicKey, BINARY):
raise Exception("Exception writing public key to pubkey.txt")
Public key could not be serialized due to a error:
2024-04-29 09:57:08,248 [MainThread ] [ERROR] Trying to save an unregistered polymorphic type (lbcrypto::FHEBFVRNS).
Make sure your type is registered with CEREAL_REGISTER_TYPE and that the archive you are using was included (and registered with CEREAL_REGISTER_ARCHIVE) prior to calling CEREAL_REGISTER_TYPE.
If your type is already registered and you still see this error, you may need to use CEREAL_REGISTER_DYNAMIC_INIT.
Hi! I've discovered an issue with key's serialization for BFV scheme. The issue was discovered using openfhe-python, but it looks like a problem in openfhe library. The issue was found in the following source code
Public key could not be serialized due to a error:
During a discussion @dsuponitskiy pointed out to the section of source code leads to the error and suggested a fix. Based on this I've prepared a pull request: https://github.com/openfheorg/openfhe-development/pull/752 .