nvflare.app_common.homomorphic_encryption.he_model_shareable_generator module

class HEModelShareableGenerator(tenseal_context_file='server_context.tenseal')[source]

Bases: FullModelShareableGenerator

This ShareableGenerator converts between Shareable and Learnable objects.

This conversion is done with homomorphic encryption (HE) support using TenSEAL https://github.com/OpenMined/TenSEAL.

Parameters

tenseal_context_file – tenseal context files containing decryption keys and parameters

add_to_global_weights(fl_ctx: FLContext, new_val, base_weights, v_name, encrypt_layers)[source]
handle_event(event_type: str, fl_ctx: FLContext)[source]

Handles events.

Parameters
  • event_type (str) – event type fired by workflow.

  • fl_ctx (FLContext) – FLContext information.

shareable_to_learnable(shareable: Shareable, fl_ctx: FLContext) Learnable[source]

Updates the global model in Learnable in encrypted space.

Parameters
  • shareable – shareable

  • fl_ctx – FLContext

Returns

Learnable object