Hello,
I am building a client–server application using OpenFHE, where the client side runs in JavaScript using OpenFHE compiled to WebAssembly (via Emscripten), and the server side is a C++ backend.
On the client side, I serialize OpenFHE objects including the public key, ciphertexts, and evaluation keys (EvalMult and EvalRotation keys) using the SerializeToBuffer() function from the OpenFHE WASM bindings. The resulting buffer (Uint8Array) is converted to Base64 and sent to the server via an HTTP POST request.
On the C++ backend, I decode the Base64 string, convert it into a std::vector<uint8_t>, wrap the bytes into a binary stream using std::istringstream, and then attempt to deserialize the objects using Serial::Deserialize(object, stream, SerType::BINARY).
During deserialization on the C++ side, the application crashes with the following error:
Internal error: can’t free this _ntl_gbigint
Aborted (core dumped)
I have verified that the byte buffers appear identical on both the client and server sides (by comparing head/tail bytes and checksums). Serialization and deserialization work correctly when everything is done entirely in C++. The issue only occurs when the data is serialized in JavaScript/WASM and deserialized in native C++.
Any guidance would be greatly appreciated.
Thank you in advance.