distributed_keygen.paillier_shared_key module¶
Paillier secret key that is shared amongst several parties.
- class distributed_keygen.paillier_shared_key.PaillierSharedKey(n, t, player_id, share, theta)[source]¶
Bases:
SecretKey
Class containing relevant attributes and methods of a shared paillier key.
- __init__(n, t, player_id, share, theta)[source]¶
Initializes a Paillier shared key.
- Parameters:
n (
int
) – modulus of the DistributedPaillier scheme this secret key belongs tot (
int
) – corruption_threshold of the secret sharingplayer_id (
int
) – the index of the player to whom the key belongsshare (
IntegerShares
) – secret sharing of the exponent used during decryptiontheta (
int
) – Value used in the computation of a full decryption after partial decryptions have been obtained. We refer to the paper for more details
- __str__()[source]¶
Utility function to represent the local share of the private key as a string.
- Return type:
str
- Returns:
String representation of this private key part.
- decrypt(partial_dict)[source]¶
Function that uses partial decryptions of other parties to reconstruct a full decryption of the initial ciphertext.
- Parameters:
partial_dict (
Dict
[int
,int
]) – dictionary containing the partial decryptions of each party- Raises:
ValueError – Either in case not enough shares are known in order to decrypt. Or when the combined decryption minus one is not divisible by $N$. This last case is most likely caused by the fact the ciphertext that is being decrypted, differs between parties.
- Return type:
int
- Returns:
full decryption
- partial_decrypt(ciphertext)[source]¶
Function that does local computations to get a partial decryption of a ciphertext.
- Parameters:
ciphertext (
PaillierCiphertext
) – ciphertext to be partially decrypted- Raises:
TypeError – If the given ciphertext is not of type PaillierCiphertext.
ValueError – If the ciphertext is encrypted against a different key.
- Return type:
int
- Returns:
partial decryption of ciphertext