Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- If you have an initialized "FHEPubKey pk" you can save it to a file in the following way:
- ofstream pkFile("pk.txt");
- if (pkFile.good())
- {
- pkFile << pk;
- pkFile.close();
- }
- That's for saving he public key to a file. Now if you need to recover the key from the file you need to have an initialized "FHEPubKey" object.
- FHEPubKey otherPK(context); // Where context is an initialized FHEContext object, and must be the same context (same parameters) used with the previous public key
- ifstream inPkFile("pk.txt");
- if (inPkFile.good())
- {
- inPkFile >> otherPK;
- inPkFile.close();
- }
- Now you should have recovered the public key in otherPK.
- I would like to mention that the method used for HElib to store/recover its data objects to/from files is not efficient in storage space nor is in execution time.
- GNZL
Add Comment
Please, Sign In to add comment