nvflare.app_common.homomorphic_encryption.he_model_encryptor module¶
- class HEModelEncryptor(tenseal_context_file='client_context.tenseal', encrypt_layers=None, aggregation_weights=None, weigh_by_local_iter=True)[source]¶
Bases:
Filter
Filter to encrypt Shareable object using homomorphic encryption (HE) with TenSEAL https://github.com/OpenMined/TenSEAL.
- Parameters
tenseal_context_file – tenseal context files containing encryption keys and parameters
encrypt_layers – if not specified (None), all layers are being encrypted; if list of variable/layer names, only specified variables are encrypted; if string containing regular expression (e.g. “conv”), only matched variables are being encrypted.
aggregation_weights – dictionary of client aggregation {“client1”: 1.0, “client2”: 2.0, “client3”: 3.0}; defaults to a weight of 1.0 if not specified.
weigh_by_local_iter – If true, multiply client weights on first before encryption (default: True which is recommended for HE)