pub trait EncryptionKey: Sized + Debug + PartialEq {
    type Input;
    type Plaintext;
    type Ciphertext: Associable<Self>;
    type Randomness;

    fn encrypt_without_randomness(
        &self,
        plaintext: &Self::Plaintext
    ) -> Self::Ciphertext; fn randomize<R: SecureRng>(
        &self,
        ciphertext: Self::Ciphertext,
        rng: &mut GeneralRng<R>
    ) -> Self::Ciphertext; fn randomize_with(
        &self,
        ciphertext: Self::Ciphertext,
        randomness: &Self::Randomness
    ) -> Self::Ciphertext; fn encrypt<'pk, R: SecureRng>(
        &'pk self,
        plaintext: &Self::Plaintext,
        rng: &mut GeneralRng<R>
    ) -> AssociatedCiphertext<'pk, Self::Ciphertext, Self> { ... } fn encrypt_raw<R: SecureRng>(
        &self,
        plaintext: &Self::Plaintext,
        rng: &mut GeneralRng<R>
    ) -> Self::Ciphertext { ... } }
Expand description

The encryption key.

Required Associated Types

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.

Required Methods

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.

Provided Methods

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.

Implementors