Struct kzen_paillier::Paillier
source · pub struct Paillier;
Expand description
Main struct onto which most operations are added.
Trait Implementations§
source§impl<EK, C> Add<EK, C, u64, EncodedCiphertext<Vec<u64, Global>>> for Paillierwhere
for<'c, 'p, 'd> Self: Add<EK, RawCiphertext<'c>, RawPlaintext<'p>, RawCiphertext<'d>>,
C: Borrow<EncodedCiphertext<Vec<u64>>>,
impl<EK, C> Add<EK, C, u64, EncodedCiphertext<Vec<u64, Global>>> for Paillierwhere
for<'c, 'p, 'd> Self: Add<EK, RawCiphertext<'c>, RawPlaintext<'p>, RawCiphertext<'d>>,
C: Borrow<EncodedCiphertext<Vec<u64>>>,
source§impl<EK, C> Add<EK, C, u64, EncodedCiphertext<u64>> for Paillierwhere
for<'c, 'p, 'd> Self: Add<EK, RawCiphertext<'c>, RawPlaintext<'p>, RawCiphertext<'d>>,
C: Borrow<EncodedCiphertext<u64>>,
impl<EK, C> Add<EK, C, u64, EncodedCiphertext<u64>> for Paillierwhere
for<'c, 'p, 'd> Self: Add<EK, RawCiphertext<'c>, RawPlaintext<'p>, RawCiphertext<'d>>,
C: Borrow<EncodedCiphertext<u64>>,
source§impl<EK, C1, C2> Add<EK, C1, C2, EncodedCiphertext<Vec<u64, Global>>> for Paillierwhere
for<'c1, 'c2, 'd> Self: Add<EK, RawCiphertext<'c1>, RawCiphertext<'c2>, RawCiphertext<'d>>,
C1: Borrow<EncodedCiphertext<Vec<u64>>>,
C2: Borrow<EncodedCiphertext<Vec<u64>>>,
impl<EK, C1, C2> Add<EK, C1, C2, EncodedCiphertext<Vec<u64, Global>>> for Paillierwhere
for<'c1, 'c2, 'd> Self: Add<EK, RawCiphertext<'c1>, RawCiphertext<'c2>, RawCiphertext<'d>>,
C1: Borrow<EncodedCiphertext<Vec<u64>>>,
C2: Borrow<EncodedCiphertext<Vec<u64>>>,
source§impl<EK, C1, C2> Add<EK, C1, C2, EncodedCiphertext<u64>> for Paillierwhere
for<'c1, 'c2, 'd> Self: Add<EK, RawCiphertext<'c1>, RawCiphertext<'c2>, RawCiphertext<'d>>,
C1: Borrow<EncodedCiphertext<u64>>,
C2: Borrow<EncodedCiphertext<u64>>,
impl<EK, C1, C2> Add<EK, C1, C2, EncodedCiphertext<u64>> for Paillierwhere
for<'c1, 'c2, 'd> Self: Add<EK, RawCiphertext<'c1>, RawCiphertext<'c2>, RawCiphertext<'d>>,
C1: Borrow<EncodedCiphertext<u64>>,
C2: Borrow<EncodedCiphertext<u64>>,
source§impl<EK, C2> Add<EK, u64, C2, EncodedCiphertext<u64>> for Paillierwhere
for<'m, 'c, 'd> Self: Add<EK, RawPlaintext<'m>, RawCiphertext<'c>, RawCiphertext<'d>>,
C2: Borrow<EncodedCiphertext<u64>>,
impl<EK, C2> Add<EK, u64, C2, EncodedCiphertext<u64>> for Paillierwhere
for<'m, 'c, 'd> Self: Add<EK, RawPlaintext<'m>, RawCiphertext<'c>, RawCiphertext<'d>>,
C2: Borrow<EncodedCiphertext<u64>>,
source§impl<'c, 'm, 'd> Add<EncryptionKey, RawCiphertext<'c>, RawPlaintext<'m>, RawCiphertext<'d>> for Paillier
impl<'c, 'm, 'd> Add<EncryptionKey, RawCiphertext<'c>, RawPlaintext<'m>, RawCiphertext<'d>> for Paillier
source§fn add(
ek: &EncryptionKey,
c: RawCiphertext<'c>,
m: RawPlaintext<'m>
) -> RawCiphertext<'d>
fn add(
ek: &EncryptionKey,
c: RawCiphertext<'c>,
m: RawPlaintext<'m>
) -> RawCiphertext<'d>
Homomorphically combine ciphertexts
c1
and c2
to obtain a ciphertext containing
the sum of the two underlying plaintexts, reduced modulus n
from ek
.source§impl<'c1, 'c2, 'd> Add<EncryptionKey, RawCiphertext<'c1>, RawCiphertext<'c2>, RawCiphertext<'d>> for Paillier
impl<'c1, 'c2, 'd> Add<EncryptionKey, RawCiphertext<'c1>, RawCiphertext<'c2>, RawCiphertext<'d>> for Paillier
source§fn add(
ek: &EncryptionKey,
c1: RawCiphertext<'c1>,
c2: RawCiphertext<'c2>
) -> RawCiphertext<'d>
fn add(
ek: &EncryptionKey,
c1: RawCiphertext<'c1>,
c2: RawCiphertext<'c2>
) -> RawCiphertext<'d>
Homomorphically combine ciphertexts
c1
and c2
to obtain a ciphertext containing
the sum of the two underlying plaintexts, reduced modulus n
from ek
.source§impl<'c, 'm, 'd> Add<EncryptionKey, RawPlaintext<'m>, RawCiphertext<'c>, RawCiphertext<'d>> for Paillier
impl<'c, 'm, 'd> Add<EncryptionKey, RawPlaintext<'m>, RawCiphertext<'c>, RawCiphertext<'d>> for Paillier
source§fn add(
ek: &EncryptionKey,
m: RawPlaintext<'m>,
c: RawCiphertext<'c>
) -> RawCiphertext<'d>
fn add(
ek: &EncryptionKey,
m: RawPlaintext<'m>,
c: RawCiphertext<'c>
) -> RawCiphertext<'d>
Homomorphically combine ciphertexts
c1
and c2
to obtain a ciphertext containing
the sum of the two underlying plaintexts, reduced modulus n
from ek
.source§impl<DK, C> Decrypt<DK, C, Vec<u64, Global>> for Paillierwhere
for<'c, 'p> Self: Decrypt<DK, RawCiphertext<'c>, RawPlaintext<'p>>,
C: Borrow<EncodedCiphertext<Vec<u64>>>,
impl<DK, C> Decrypt<DK, C, Vec<u64, Global>> for Paillierwhere
for<'c, 'p> Self: Decrypt<DK, RawCiphertext<'c>, RawPlaintext<'p>>,
C: Borrow<EncodedCiphertext<Vec<u64>>>,
source§impl<DK, C> Decrypt<DK, C, u64> for Paillierwhere
for<'c, 'p> Self: Decrypt<DK, RawCiphertext<'c>, RawPlaintext<'p>>,
C: Borrow<EncodedCiphertext<u64>>,
impl<DK, C> Decrypt<DK, C, u64> for Paillierwhere
for<'c, 'p> Self: Decrypt<DK, RawCiphertext<'c>, RawPlaintext<'p>>,
C: Borrow<EncodedCiphertext<u64>>,
source§impl<'c, 'm> Decrypt<DecryptionKey, &'c RawCiphertext<'c>, RawPlaintext<'m>> for Paillier
impl<'c, 'm> Decrypt<DecryptionKey, &'c RawCiphertext<'c>, RawPlaintext<'m>> for Paillier
TODO
Efficient decryption using CRT based on Paillier99, section 7
source§fn decrypt(dk: &DecryptionKey, c: &'c RawCiphertext<'c>) -> RawPlaintext<'m>
fn decrypt(dk: &DecryptionKey, c: &'c RawCiphertext<'c>) -> RawPlaintext<'m>
Decrypt ciphertext
c
using key dk
into a plaintext.source§impl<'c, 'm> Decrypt<DecryptionKey, RawCiphertext<'c>, RawPlaintext<'m>> for Paillier
impl<'c, 'm> Decrypt<DecryptionKey, RawCiphertext<'c>, RawPlaintext<'m>> for Paillier
TODO
Efficient decryption using CRT based on Paillier99, section 7
source§fn decrypt(dk: &DecryptionKey, c: RawCiphertext<'c>) -> RawPlaintext<'m>
fn decrypt(dk: &DecryptionKey, c: RawCiphertext<'c>) -> RawPlaintext<'m>
Decrypt ciphertext
c
using key dk
into a plaintext.source§impl<'m, 'd> Encrypt<DecryptionKey, RawPlaintext<'m>, RawCiphertext<'d>> for Paillier
impl<'m, 'd> Encrypt<DecryptionKey, RawPlaintext<'m>, RawCiphertext<'d>> for Paillier
source§fn encrypt(dk: &DecryptionKey, m: RawPlaintext<'m>) -> RawCiphertext<'d>
fn encrypt(dk: &DecryptionKey, m: RawPlaintext<'m>) -> RawCiphertext<'d>
Encrypt plaintext
m
under key ek
into a ciphertext.source§impl<'m, EK> Encrypt<EK, &'m [u64], EncodedCiphertext<Vec<u64, Global>>> for Paillierwhere
for<'p, 'c> Self: Encrypt<EK, RawPlaintext<'p>, RawCiphertext<'c>>,
impl<'m, EK> Encrypt<EK, &'m [u64], EncodedCiphertext<Vec<u64, Global>>> for Paillierwhere
for<'p, 'c> Self: Encrypt<EK, RawPlaintext<'p>, RawCiphertext<'c>>,
source§impl<EK> Encrypt<EK, u64, EncodedCiphertext<u64>> for Paillierwhere
for<'p, 'c> Self: Encrypt<EK, RawPlaintext<'p>, RawCiphertext<'c>>,
impl<EK> Encrypt<EK, u64, EncodedCiphertext<u64>> for Paillierwhere
for<'p, 'c> Self: Encrypt<EK, RawPlaintext<'p>, RawCiphertext<'c>>,
source§impl<'m, 'd> Encrypt<EncryptionKey, RawPlaintext<'m>, RawCiphertext<'d>> for Paillier
impl<'m, 'd> Encrypt<EncryptionKey, RawPlaintext<'m>, RawCiphertext<'d>> for Paillier
source§fn encrypt(ek: &EncryptionKey, m: RawPlaintext<'m>) -> RawCiphertext<'d>
fn encrypt(ek: &EncryptionKey, m: RawPlaintext<'m>) -> RawCiphertext<'d>
Encrypt plaintext
m
under key ek
into a ciphertext.source§impl<'m, 'r, 'd> EncryptWithChosenRandomness<DecryptionKey, RawPlaintext<'m>, &'r PrecomputedRandomness, RawCiphertext<'d>> for Paillier
impl<'m, 'r, 'd> EncryptWithChosenRandomness<DecryptionKey, RawPlaintext<'m>, &'r PrecomputedRandomness, RawCiphertext<'d>> for Paillier
fn encrypt_with_chosen_randomness(
dk: &DecryptionKey,
m: RawPlaintext<'m>,
rn: &'r PrecomputedRandomness
) -> RawCiphertext<'d>
source§impl<'m, 'r, 'd> EncryptWithChosenRandomness<DecryptionKey, RawPlaintext<'m>, &'r Randomness, RawCiphertext<'d>> for Paillier
impl<'m, 'r, 'd> EncryptWithChosenRandomness<DecryptionKey, RawPlaintext<'m>, &'r Randomness, RawCiphertext<'d>> for Paillier
fn encrypt_with_chosen_randomness(
dk: &DecryptionKey,
m: RawPlaintext<'m>,
r: &'r Randomness
) -> RawCiphertext<'d>
source§impl<'m, 'r, 'd> EncryptWithChosenRandomness<EncryptionKey, RawPlaintext<'m>, &'r PrecomputedRandomness, RawCiphertext<'d>> for Paillier
impl<'m, 'r, 'd> EncryptWithChosenRandomness<EncryptionKey, RawPlaintext<'m>, &'r PrecomputedRandomness, RawCiphertext<'d>> for Paillier
fn encrypt_with_chosen_randomness(
ek: &EncryptionKey,
m: RawPlaintext<'m>,
rn: &'r PrecomputedRandomness
) -> RawCiphertext<'d>
source§impl<'m, 'r, 'd> EncryptWithChosenRandomness<EncryptionKey, RawPlaintext<'m>, &'r Randomness, RawCiphertext<'d>> for Paillier
impl<'m, 'r, 'd> EncryptWithChosenRandomness<EncryptionKey, RawPlaintext<'m>, &'r Randomness, RawCiphertext<'d>> for Paillier
fn encrypt_with_chosen_randomness(
ek: &EncryptionKey,
m: RawPlaintext<'m>,
r: &'r Randomness
) -> RawCiphertext<'d>
source§impl KeyGeneration<Keypair> for Paillier
impl KeyGeneration<Keypair> for Paillier
source§fn keypair_with_modulus_size(bit_length: usize) -> Keypair
fn keypair_with_modulus_size(bit_length: usize) -> Keypair
Generate fresh key pair with security level specified as the
bit_length
of the modulus. Read morefn keypair_safe_primes_with_modulus_size(bit_length: usize) -> Keypair
source§fn keypair() -> KP
fn keypair() -> KP
Generate fresh key pair with currently recommended security level (2048 bit modulus).
fn keypair_safe_primes() -> KP
source§impl<EK, C> Mul<EK, C, u64, EncodedCiphertext<Vec<u64, Global>>> for Paillierwhere
for<'c, 'm, 'd> Self: Mul<EK, RawCiphertext<'c>, RawPlaintext<'m>, RawCiphertext<'d>>,
C: Borrow<EncodedCiphertext<Vec<u64>>>,
impl<EK, C> Mul<EK, C, u64, EncodedCiphertext<Vec<u64, Global>>> for Paillierwhere
for<'c, 'm, 'd> Self: Mul<EK, RawCiphertext<'c>, RawPlaintext<'m>, RawCiphertext<'d>>,
C: Borrow<EncodedCiphertext<Vec<u64>>>,
source§impl<EK, C> Mul<EK, C, u64, EncodedCiphertext<u64>> for Paillierwhere
for<'c, 'm, 'd> Self: Mul<EK, RawCiphertext<'c>, RawPlaintext<'m>, RawCiphertext<'d>>,
C: Borrow<EncodedCiphertext<u64>>,
impl<EK, C> Mul<EK, C, u64, EncodedCiphertext<u64>> for Paillierwhere
for<'c, 'm, 'd> Self: Mul<EK, RawCiphertext<'c>, RawPlaintext<'m>, RawCiphertext<'d>>,
C: Borrow<EncodedCiphertext<u64>>,
source§impl<EK, C> Mul<EK, u64, C, EncodedCiphertext<Vec<u64, Global>>> for Paillierwhere
for<'m, 'c, 'd> Self: Mul<EK, RawPlaintext<'m>, RawCiphertext<'c>, RawCiphertext<'d>>,
C: Borrow<EncodedCiphertext<Vec<u64>>>,
impl<EK, C> Mul<EK, u64, C, EncodedCiphertext<Vec<u64, Global>>> for Paillierwhere
for<'m, 'c, 'd> Self: Mul<EK, RawPlaintext<'m>, RawCiphertext<'c>, RawCiphertext<'d>>,
C: Borrow<EncodedCiphertext<Vec<u64>>>,
source§impl<EK, C> Mul<EK, u64, C, EncodedCiphertext<u64>> for Paillierwhere
for<'m, 'c, 'd> Self: Mul<EK, RawPlaintext<'m>, RawCiphertext<'c>, RawCiphertext<'d>>,
C: Borrow<EncodedCiphertext<u64>>,
impl<EK, C> Mul<EK, u64, C, EncodedCiphertext<u64>> for Paillierwhere
for<'m, 'c, 'd> Self: Mul<EK, RawPlaintext<'m>, RawCiphertext<'c>, RawCiphertext<'d>>,
C: Borrow<EncodedCiphertext<u64>>,
source§impl<'c, 'm, 'd> Mul<EncryptionKey, RawCiphertext<'c>, RawPlaintext<'m>, RawCiphertext<'d>> for Paillier
impl<'c, 'm, 'd> Mul<EncryptionKey, RawCiphertext<'c>, RawPlaintext<'m>, RawCiphertext<'d>> for Paillier
source§fn mul(
ek: &EncryptionKey,
c: RawCiphertext<'c>,
m: RawPlaintext<'m>
) -> RawCiphertext<'d>
fn mul(
ek: &EncryptionKey,
c: RawCiphertext<'c>,
m: RawPlaintext<'m>
) -> RawCiphertext<'d>
Homomorphically combine ciphertext
c1
and plaintext m2
to obtain a ciphertext
containing the multiplication of the (underlying) plaintexts, reduced modulus n
from ek
.source§impl<'c, 'm, 'd> Mul<EncryptionKey, RawPlaintext<'m>, RawCiphertext<'c>, RawCiphertext<'d>> for Paillier
impl<'c, 'm, 'd> Mul<EncryptionKey, RawPlaintext<'m>, RawCiphertext<'c>, RawCiphertext<'d>> for Paillier
source§fn mul(
ek: &EncryptionKey,
m: RawPlaintext<'m>,
c: RawCiphertext<'c>
) -> RawCiphertext<'d>
fn mul(
ek: &EncryptionKey,
m: RawPlaintext<'m>,
c: RawCiphertext<'c>
) -> RawCiphertext<'d>
Homomorphically combine ciphertext
c1
and plaintext m2
to obtain a ciphertext
containing the multiplication of the (underlying) plaintexts, reduced modulus n
from ek
.source§impl<'c, 'm> Open<DecryptionKey, &'c RawCiphertext<'c>, RawPlaintext<'m>, Randomness> for Paillier
impl<'c, 'm> Open<DecryptionKey, &'c RawCiphertext<'c>, RawPlaintext<'m>, Randomness> for Paillier
source§fn open(
dk: &DecryptionKey,
c: &'c RawCiphertext<'c>
) -> (RawPlaintext<'m>, Randomness)
fn open(
dk: &DecryptionKey,
c: &'c RawCiphertext<'c>
) -> (RawPlaintext<'m>, Randomness)
Open ciphertext
c
using key dk
into a plaintext and a randomness.source§impl<'c, 'm> Open<DecryptionKey, RawCiphertext<'c>, RawPlaintext<'m>, Randomness> for Paillier
impl<'c, 'm> Open<DecryptionKey, RawCiphertext<'c>, RawPlaintext<'m>, Randomness> for Paillier
source§fn open(
dk: &DecryptionKey,
c: RawCiphertext<'c>
) -> (RawPlaintext<'m>, Randomness)
fn open(
dk: &DecryptionKey,
c: RawCiphertext<'c>
) -> (RawPlaintext<'m>, Randomness)
Open ciphertext
c
using key dk
into a plaintext and a randomness.source§impl<'ek, 'r> PrecomputeRandomness<&'ek EncryptionKey, &'r BigInt, PrecomputedRandomness> for Paillier
impl<'ek, 'r> PrecomputeRandomness<&'ek EncryptionKey, &'r BigInt, PrecomputedRandomness> for Paillier
fn precompute(ek: &'ek EncryptionKey, r: &'r BigInt) -> PrecomputedRandomness
source§impl<EK, C> Rerandomize<EK, C, EncodedCiphertext<Vec<u64, Global>>> for Paillierwhere
for<'c, 'd> Self: Rerandomize<EK, RawCiphertext<'c>, RawCiphertext<'d>>,
C: Borrow<EncodedCiphertext<Vec<u64>>>,
impl<EK, C> Rerandomize<EK, C, EncodedCiphertext<Vec<u64, Global>>> for Paillierwhere
for<'c, 'd> Self: Rerandomize<EK, RawCiphertext<'c>, RawCiphertext<'d>>,
C: Borrow<EncodedCiphertext<Vec<u64>>>,
source§fn rerandomize(ek: &EK, c: C) -> EncodedCiphertext<Vec<u64>>
fn rerandomize(ek: &EK, c: C) -> EncodedCiphertext<Vec<u64>>
Rerandomise ciphertext
c
to hide any history of which homomorphic operations were
used to compute it, making it look exactly like a fresh encryption of the same plaintext.source§impl<EK, C> Rerandomize<EK, C, EncodedCiphertext<u64>> for Paillierwhere
for<'c, 'd> Self: Rerandomize<EK, RawCiphertext<'c>, RawCiphertext<'d>>,
C: Borrow<EncodedCiphertext<u64>>,
impl<EK, C> Rerandomize<EK, C, EncodedCiphertext<u64>> for Paillierwhere
for<'c, 'd> Self: Rerandomize<EK, RawCiphertext<'c>, RawCiphertext<'d>>,
C: Borrow<EncodedCiphertext<u64>>,
source§fn rerandomize(ek: &EK, c: C) -> EncodedCiphertext<u64>
fn rerandomize(ek: &EK, c: C) -> EncodedCiphertext<u64>
Rerandomise ciphertext
c
to hide any history of which homomorphic operations were
used to compute it, making it look exactly like a fresh encryption of the same plaintext.source§impl<'c, 'd> Rerandomize<EncryptionKey, RawCiphertext<'c>, RawCiphertext<'d>> for Paillier
impl<'c, 'd> Rerandomize<EncryptionKey, RawCiphertext<'c>, RawCiphertext<'d>> for Paillier
source§fn rerandomize(ek: &EncryptionKey, c: RawCiphertext<'c>) -> RawCiphertext<'d>
fn rerandomize(ek: &EncryptionKey, c: RawCiphertext<'c>) -> RawCiphertext<'d>
Rerandomise ciphertext
c
to hide any history of which homomorphic operations were
used to compute it, making it look exactly like a fresh encryption of the same plaintext.