Skip to main content

compute_intersection_rsa

RSA Blinding Private Set intersection.

Order of operations:

  1. Modeller sends the task request to the worker, containing the columns on which the intersection should be performed.

  2. Worker generates an RSA key pair, and sends the public key to the modeller, keeping the private key to themself.

  3. Worker hashes and uses his private key to encrypt each row for the relevant columns, and then hashes again the obtained values.

    Modeller receives the public key from the pod. Then he chooses random factors (as many as the size of the rows in his data), which he encrypts using the public key. He then hashes each row of his input and multiplies it with the encrypted random factors, which is referred to as blinding.

  4. Modeller sends his blinded inputs to the worker.

  5. Worker receives the blinded inputs from the modeller. He first encrypts the blinded values using his private key, and then hashes each of the results. He then sends the list of blinded hashed values and the list of hashed values from step 3 to the modeller.

  6. Modeller receives the two lists from the pod. He then can compute the private set intersection.

For more details see: https://eprint.iacr.org/2009/491.pdf

Module

Functions

hash

def hash(record: Any, hash_function: HashAlgorithm)> int:

Compute the hash of an individual record.

Arguments

  • record: The record to hash.
  • hash_function: the hash function to use.

Returns An integer corresponding to the hashed value of the record.

hash_set

def hash_set(    dataset: Union[pd.DataFrame, List[Any], pd.Series], hash_function: HashAlgorithm,)> List[int]:

Hash the dataset with the given hash function.

Returns The hashed dataset as a list of integers.

Classes

ComputeIntersectionRSA

class ComputeIntersectionRSA(    datasource_columns: Optional[List[str]] = None,    datasource_table: Optional[str] = None,    pod_columns: Optional[List[str]] = None,    pod_table: Optional[str] = None,):

Algorithm for computing the private set intersection with RSA blinding.

caution

This algorithm does not work with iterable datasources such as multi-table databases.

Arguments

  • datasource_columns: The modeller's columns from their datasource on which the private set intersection will be computed as a list of strings. Defaults to None.
  • datasource_table: The modeller's table from their datasource, if the datasource is multitable, on which the private set intersection will be computed as a string. Defaults to None.
  • pod_columns: The pod's columns from their datasource on which the private set intersection will be computed as a list of strings. Defaults to None.
  • pod_table: The pod's table from their datasource, if the datasource is multitable, on which the private set intersection will be computed as a string. Defaults to None.

Attributes

  • class_name: The name of the algorithm class.
  • fields_dict: A dictionary mapping all attributes that will be serialized in the class to their marshamllow field type. (e.g. fields_dict = {"class_name": fields.Str()}).
  • nested_fields: A dictionary mapping all nested attributes to a registry that contains class names mapped to the respective classes. (e.g. nested_fields = {"datastructure": datastructure.registry})
  • pod_columns: The pod's columns from their datasource on which the private set intersection will be computed as a list of strings. Defaults to None.
  • pod_table: The pod's table from their datasource, if the datasource is multitable, on which the private set intersection will be computed as a string. Defaults to None.

Ancestors

  • BaseAlgorithmFactory
  • bitfount.federated.mixins._PSIAlgorithmsMixIn
  • abc.ABC
  • bitfount.federated.roles._RolesMixIn
  • bitfount.types._BaseSerializableObjectMixIn
  • bitfount.federated.types._DataLessAlgorithm

Variables

Methods


create

def create(self, role: Union[str, Role], **kwargs: Any)> Any:

Create an instance representing the role specified.

execute

def execute(    self: _PSICompatibleAlgoFactory_,    pod_identifiers: List[str],    datasource: BaseSource,    datasource_columns: Optional[List[str]] = None,    datasource_table: Optional[str] = None,    pod_columns: Optional[List[str]] = None,    pod_table: Optional[str] = None,    username: Optional[str] = None,    bitfounthub: Optional[BitfountHub] = None,    ms_config: Optional[MessageServiceConfig] = None,    message_service: Optional[_MessageService] = None,    pod_public_key_paths: Optional[Mapping[str, Path]] = None,    identity_verification_method: IdentityVerificationMethod = IdentityVerificationMethod.OIDC_DEVICE_CODE,    private_key_or_file: Optional[Union[RSAPrivateKey, Path]] = None,    idp_url: Optional[str] = None,    require_all_pods: bool = False,    project_id: Optional[str] = None,)> List[pd.DataFrame]:

Execute PSI compatible algorithm.

Syntactic sugar to allow the modeller to call .intersect(...) on PrivateSetIntersection compatible algorithms.

Arguments

  • pod_identifiers: The pod identifier for the Private Set Intersection as a list.
  • datasource: The modeller datasource on which the Private Set Intersection will be performed on.
  • datasource_columns: The modeller's columns from their datasource on which the private set intersection will be computed as a list of strings. Defaults to None.
  • datasource_table: The modeller's table from their datasource, if the datasource is multitable, on which the private set intersection will be computed as a string. Defaults to None.
  • pod_columns: The pod's columns from their datasource on which the private set intersection will be computed as a list of strings. Defaults to None.
  • pod_table: The pod's table from their datasource, if the datasource is multitable, on which the private set intersection will be computed as a string. Defaults to None.
  • username: The modeller's username. Defaults to None.
  • bitfounthub: The bifount hub instance. Defaults to None.
  • ms_config: Configuration for the message service. Defaults to None.
  • message_service: The message service to use. Defaults to None.
  • pod_public_key_paths: The path for the pod public key. Used when authentication with the pod is done with the public key. Defaults to None.
  • identity_verification_method: The identity verification method to use. Defaults to None.
  • private_key_or_file: The private key or path to the private key. Defaults to None.
  • idp_url: The identity provider url. Defaults to None.
  • require_all_pods: Whether all pods are needed for the algorithm. Defaults to False.

Returns The records from the modeller dataset which were found in the intersection.

Raises

  • PSIMultiplePodsError: If execute is called on multiple pods.

modeller

def modeller(    self, **kwargs: Any,)> bitfount.federated.algorithms.compute_intersection_rsa._ModellerSide:

Returns the modeller side of the SqlQuery algorithm.

worker

def worker(    self, **kwargs: Any,)> bitfount.federated.algorithms.compute_intersection_rsa._WorkerSide:

Returns the worker side of the SqlQuery algorithm.