pub struct PaillierPK {
    pub n: UnsignedInteger,
    pub g: UnsignedInteger,
}
Expand description

Public key for the Paillier cryptosystem.

Fields

n: UnsignedInteger

Public modulus n for encryption

g: UnsignedInteger

Public generator g for encryption

Trait Implementations

‘Enriches’ a ciphertext by associating it with a corresponding public key. This allows to overlead operators for homomorphic operations.

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Decrypts a rich Paillier ciphertext using the secret key.

println!("The decrypted message is {}", secret_key.decrypt(&ciphertext));
// Prints: "The decrypted message is 5".

Returns true if the encrypted value equals the identity. This is typically faster than a full decryption.

Decrypt the associated ciphertext using the secret key.

Returns true if the associated ciphertext encrypts the identity. This is typically faster than a full decryption.

Deserialize this value from the given Serde deserializer. Read more

Input is the type used to multiply additive ciphertexts or exponentiate multiplicative ciphertexts.

The type of the plaintext to be encrypted.

The type of an encrypted plaintext, i.e. a ciphertext.

The type of the randomness used.

WARNING: This is not a full encryption. The resulting ciphertext is completely insecure. ‘Encrypts’ the plaintext using the public key deterministically, essentially creating a trivial ciphertext. The encryption is not secure until you call randomize or randomize_with with suitable randomness.

Randomizes the ciphertext with the supplied rng.

Randomizes the ciphertext with the user supplied randomness.

Encrypt the plaintext using the public key and a cryptographic RNG and immediately associate it with the public key.

Encrypt the plaintext using the public key and a cryptographic RNG.

Combines two ciphertexts so that their decrypted value reflects some addition operation

Applies some operation on a ciphertext so that the decrypted value reflects some multiplication with input

Combines two ciphertexts so that their decrypted value reflects some subtract operation

Combines two ciphertexts so that their decrypted value reflects some addition operation with a constant

Combines two ciphertexts so that their decrypted value reflects some subtract operation with a constant

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Casts the value.

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Casts the value.

Casts the value.

Casts the value.

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Casts the value.

Casts the value.

Should always be Self

Casts the value.

Casts the value.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Casts the value.

Casts the value.

Casts the value.

Casts the value.