I want to serialize a (resulting) Plaintext
to JSON format similar to a Ciphertext<DCRTPoly>
. How can I achieve this?
Exception thrown from main(): Trying to save an unregistered polymorphic type (lbcrypto::CKKSPackedEncoding).
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.
OpenFHE does not currently support the serialization of plaintexts (out of the box). If you need to serialize the encoded polynomial (DCRTPoly), you can serialize it directly by calling the GetElement<DCRTPoly>()
method for the plaintext.
Thank you for your prompt reply. I want to retrieve encoded vector (numbers), not the polynomial form. As a workaround, I am currently writing a PlainText object (to a file) that prints values with precision and using text formatting to remove the precision part. It would be nice to just get the values.
We are treating vectors of real numbers or signed integers as part of applications. So it is up to the application developer to add serialization support for those. There is no crypto involved here. Only encoded polynomials contain something specific to lattice crypto, like modulus, ring dimension, etc.