secure_inner_join.database_owner module

Module contains DatabaseOwner class (either Alice or Bob) for performing secure set intersection

class secure_inner_join.database_owner.DatabaseOwner(*args, data, feature_names=(), paillier_scheme=<tno.mpc.encryption_schemes.paillier.paillier.Paillier object>, ran_length=64, **kwargs)[source]

Bases: Player

Class for a database owner

class Collection(feature_names=None, intersection_size=None, paillier_scheme=None, randomness=None, share=None)[source]

Bases: object

Nested data class to store received data

feature_names: Optional[Tuple[str, ...]] = None
intersection_size: Optional[int] = None
paillier_scheme: Optional[Paillier] = None
randomness: Optional[int] = None
share: Optional[ndarray] = None
__init__(*args, data, feature_names=(), paillier_scheme=<tno.mpc.encryption_schemes.paillier.paillier.Paillier object>, ran_length=64, **kwargs)[source]

Initializes a database owner instance

Parameters:
  • data (ndarray) – data of the database owner, first column should contain the identifiers

  • feature_names (Tuple[str, ...]) – optional names of the shared features

  • paillier_scheme (Paillier) – a tno.mpc.encryption_schemes.paillier.Paillier instance

  • ran_length (int) – number of bits for shared randomness salt

Raises:

ValueError – raised when helper or data parties are not in the pool.

encrypt_data()[source]

Encrypts the data

Return type:

None

property feature_names: Tuple[str, ...] | None

The feature names of the inner join in the same order for both database owners

Returns:

feature names

generate_share()[source]

Generates a random additive share

Return type:

None

hash_data()[source]

Hashes the identifiers of the dataset

Return type:

None

property intersection_size: int

The intersection size determined by the helper

Returns:

size of intersection

Raises:

ValueError – raised when there is no intersection size available yet

async receive_feature_names()[source]

Receive the feature names of the other data party

Return type:

None

async receive_intersection_size()[source]

Receive the computed intersection size

Return type:

None

async receive_paillier_scheme()[source]

Receive the Paillier scheme of the other party, this enables encryption with their public key.

Return type:

None

async receive_randomness()[source]

Receive randomness from other data_owner to be used in the salted hash

Return type:

None

async receive_share()[source]

Receive an additive share of your own attributes (columns)

Return type:

None

property received_paillier_scheme: Paillier

The received Paillier scheme

Returns:

the received Paillier scheme

Raises:

ValueError – raised when there is no paillier scheme received yet

async run_protocol()[source]

Run the entire protocol, start to end, in an asynchronous manner

Return type:

None

async send_encrypted_data()[source]

Send the encrypted data to the helper

Return type:

None

async send_feature_names()[source]

Send the feature names of the data set to the other data party

Return type:

None

async send_paillier_scheme()[source]

Send the Paillier scheme to the other party, this enables encryption with your public key. The private key is NOT sent.

Return type:

None

async send_randomness()[source]

Send randomness to other data_owner to be used in the salted hash

Return type:

None

async send_share()[source]

Send a random generated share to the helper party

Return type:

None

property shared_randomness: int

The shared randomness (sum of own randomness and that of the other party)

Returns:

shared randomness

property shares: ndarray

The shares of the secure inner join

Returns:

the secure inner join shares

Raises:

ValueError – raised when not all shares are available