Closed dubek closed 1 year ago
Hi @dubek an @HayimShaul
Reading/Writing individual keys (public and secret) as well as individually reading/writing the context are already supported in HElib. Binary format has been supported for more than a year and JSON was added at end of last year.
Having said that, in HElib, the current support for writing/reading the secrete key(SK) to a file, does include the public key (PK) which can make the file bigger. We did that to guarantee that we always have the matching SK/PK pair. In HElib, for historic reasons, the secret key is implemented as a derived class from the public key class making them tightly coupled and separating them would incur a big refactoring of the codebase.
Separating the keys as you proposed would potentially lead to a mismatch between the SK and PK in an application that is reading in separate files for the SK and PK before reconstructing the SK. This would put the onus on the user to enforce/guarantee correctness.
With your proposed changes, one would have to read in the PK and the SK files to reconstruct the SK. SO, I don’t really see much benefit in the separation you proposed. We are reluctant to add the APIs proposed in this PR, as in its current state they can lead to errors.
@dubek and @HayimShaul. Closing this PR as the functionality for saving PK and SK keys individually has now been implemented by PR #493 which contains additional extensions.
Add new API calls (
writeOnlySecretKeyTo
,readOnlySecretKeyFrom
) to save/load just the secret key, resulting in a much smaller file.Author: @HayimShaul cc: @aehud