pub trait LweCiphertextDecryptionEngine<SecretKey, Ciphertext, Plaintext>: AbstractEngine where
SecretKey: LweSecretKeyEntity,
Ciphertext: LweCiphertextEntity<KeyDistribution = SecretKey::KeyDistribution>,
Plaintext: PlaintextEntity, {
fn decrypt_lwe_ciphertext(
&mut self,
key: &SecretKey,
input: &Ciphertext
) -> Result<Plaintext, LweCiphertextDecryptionError<Self::EngineError>>;
unsafe fn decrypt_lwe_ciphertext_unchecked(
&mut self,
key: &SecretKey,
input: &Ciphertext
) -> Plaintext;
}
Expand description
A trait for engines decrypting LWE ciphertexts.
Semantics
This pure operation generates an plaintext containing the
decryption of the input
LWE ciphertext, under the key
secret key.
Formal Definition
LWE Decryption
inputs:
- $\mathsf{ct} = \left( \vec{a} , b\right) \in \mathsf{LWE}^n_{\vec{s}}( \mathsf{pt} )\subseteq \mathbb{Z}_q^{(n+1)}$: an LWE ciphertext
- $\vec{s}\in\mathbb{Z}_q^n$: a secret key
outputs:
- $\mathsf{pt}\in\mathbb{Z}_q$: a plaintext
algorithm:
- compute $\mathsf{pt} = b - \left\langle \vec{a} , \vec{s} \right\rangle \in\mathbb{Z}_q$
- output $\mathsf{pt}$
Remark: Observe that the decryption is followed by a decoding phase that will contain a rounding.
Required Methods
fn decrypt_lwe_ciphertext(
&mut self,
key: &SecretKey,
input: &Ciphertext
) -> Result<Plaintext, LweCiphertextDecryptionError<Self::EngineError>>
fn decrypt_lwe_ciphertext(
&mut self,
key: &SecretKey,
input: &Ciphertext
) -> Result<Plaintext, LweCiphertextDecryptionError<Self::EngineError>>
Decrypts an LWE ciphertext.
unsafe fn decrypt_lwe_ciphertext_unchecked(
&mut self,
key: &SecretKey,
input: &Ciphertext
) -> Plaintext
unsafe fn decrypt_lwe_ciphertext_unchecked(
&mut self,
key: &SecretKey,
input: &Ciphertext
) -> Plaintext
Unsafely decrypts an LWE ciphertext.
Safety
For the general safety concerns regarding this operation, refer to the different variants
of LweCiphertextDecryptionError
. For safety concerns specific to an
engine, refer to the implementer safety section.
Implementors
impl LweCiphertextDecryptionEngine<LweSecretKey32, LweCiphertext32, Plaintext32> for DefaultEngine
Description:
Implementation of LweCiphertextDecryptionEngine
for DefaultEngine
that operates on
32 bits integers.
impl LweCiphertextDecryptionEngine<LweSecretKey32, LweCiphertextView32<'_>, Plaintext32> for DefaultEngine
Description:
Implementation of LweCiphertextDecryptionEngine
for DefaultEngine
that operates on
an LweCiphertextView32
containing 32 bits integers.
impl LweCiphertextDecryptionEngine<LweSecretKey64, LweCiphertext64, Plaintext64> for DefaultEngine
Description:
Implementation of LweCiphertextDecryptionEngine
for DefaultEngine
that operates on
64 bits integers.
impl LweCiphertextDecryptionEngine<LweSecretKey64, LweCiphertextView64<'_>, Plaintext64> for DefaultEngine
Description:
Implementation of LweCiphertextDecryptionEngine
for DefaultEngine
that operates on
an LweCiphertextView64
containing 64 bits integers.