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.
- class SerializedPaillierSharedKey[source]¶
Bases:
TypedDict
Serialized PaillierSharedKey for e.g. storing the key to disk.
- n:
int
¶
- player_id:
int
¶
- share:
IntegerShares
¶
- t:
int
¶
- theta:
int
¶
- n:
- __eq__(other)[source]¶
Compare this PaillierSharedKey with another to determine (in)equality.
- Parameters:
other (
object
) – Object to compare this PaillierSharedKey with.- Raises:
TypeError – When other object is not a PaillierSharedKey.
- Return type:
bool
- Returns:
Boolean value representing (in)equality of both objects.
- __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
- static deserialize(obj, **_kwargs)[source]¶
Deserialization function for public keys, which will be passed to the communication module.
- Parameters:
obj (
SerializedPaillierSharedKey
) – serialized version of a PaillierSharedKey.**_kwargs (
Any
) – optional extra keyword arguments
- Raises:
SerializationError – When communication library is not installed.
- Return type:
- Returns:
Deserialized PaillierSharedKey from the given dict.
- 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
- serialize(**_kwargs)[source]¶
Serialization function for public keys, which will be passed to the communication module.
- Parameters:
**_kwargs (
Any
) – optional extra keyword arguments- Raises:
SerializationError – When communication library is not installed.
- Return type:
- Returns:
serialized version of this PaillierSharedKey.