pub trait GlweSeededCiphertextVectorEncryptionEngine<SecretKey, PlaintextVector, CiphertextVector>: AbstractEnginewhere
SecretKey: GlweSecretKeyEntity,
PlaintextVector: PlaintextVectorEntity,
CiphertextVector: GlweSeededCiphertextVectorEntity,{
fn encrypt_glwe_seeded_ciphertext_vector(
&mut self,
key: &SecretKey,
input: &PlaintextVector,
noise: Variance
) -> Result<CiphertextVector, GlweSeededCiphertextVectorEncryptionError<Self::EngineError>>;
unsafe fn encrypt_glwe_seeded_ciphertext_vector_unchecked(
&mut self,
key: &SecretKey,
input: &PlaintextVector,
noise: Variance
) -> CiphertextVector;
}
Expand description
A trait for engines encrypting GLWE seeded ciphertext vectors.
Semantics
This pure operation generates a GLWE seeded ciphertext vector
containing the piece-wise encryptions of the input
plaintext vector, under the key
secret
key.
Formal Definition
Seeded GLWE vector encryption
inputs:
- $\vec{\mathsf{PT}}\in\mathcal{R}_q^t$: a plaintext vector
- $\vec{S} \in\mathcal{R}_q^k$: a secret key
- $\mathsf{seed} \in\mathcal{S}$: a public seed
- $G$: a CSPRNG working with seeds from $\mathcal{S}$
- $\mathcal{D}_{\sigma^2,\mu}$: a normal distribution of variance $\sigma^2$ and a mean $\mu$
outputs:
- $\vec{\tilde{\mathsf{CT}}} = \left( \mathsf{seed} , \vec{\tilde{B}} \right) \in \mathsf{SeededGLWEVector}^{k,t}_{\vec{S}, G}( \vec{\mathsf{PT}} )\subseteq \mathcal{S}\times \mathcal{R}_q^t$: a seeded GLWE ciphertext vector
algorithm:
- let $\vec{B} \in \mathcal{R}_q^t$
- Seed $G$ with the seed $\mathsf{seed}\in\mathcal{S}$
- for each $(B_i, \mathsf{PT_i})$ in $(\vec{B}, \vec{\mathsf{PT}})$
- uniformly sample each coefficient of the polynomial vector $\vec{A}\in\mathcal{R}^k_q$ from $G$
- sample each integer error coefficient of an error polynomial $E\in\mathcal{R}_q$ from $\mathcal{D_{\sigma^2,\mu}}$
- compute $B_i = \left\langle \vec{A} , \vec{S} \right\rangle + \mathsf{PT} + E \in\mathcal{R}_q$
- output $\left( \mathsf{seed} , \vec{B}\right)$
Required Methods
sourcefn encrypt_glwe_seeded_ciphertext_vector(
&mut self,
key: &SecretKey,
input: &PlaintextVector,
noise: Variance
) -> Result<CiphertextVector, GlweSeededCiphertextVectorEncryptionError<Self::EngineError>>
fn encrypt_glwe_seeded_ciphertext_vector(
&mut self,
key: &SecretKey,
input: &PlaintextVector,
noise: Variance
) -> Result<CiphertextVector, GlweSeededCiphertextVectorEncryptionError<Self::EngineError>>
Encrypts a GLWE seeded ciphertext vector.
sourceunsafe fn encrypt_glwe_seeded_ciphertext_vector_unchecked(
&mut self,
key: &SecretKey,
input: &PlaintextVector,
noise: Variance
) -> CiphertextVector
unsafe fn encrypt_glwe_seeded_ciphertext_vector_unchecked(
&mut self,
key: &SecretKey,
input: &PlaintextVector,
noise: Variance
) -> CiphertextVector
Unsafely encrypts a GLWE seeded ciphertext vector.
Safety
For the general safety concerns regarding this operation, refer to the different variants
of GlweSeededCiphertextVectorEncryptionError
. For safety concerns specific to an
engine, refer to the implementer safety section.
Implementors
impl GlweSeededCiphertextVectorEncryptionEngine<GlweSecretKey32, PlaintextVector32, GlweSeededCiphertextVector32> for DefaultEngine
Description:
Implementation of GlweSeededCiphertextVectorEncryptionEngine
for DefaultEngine
that
operates on 32 bits integers.
impl GlweSeededCiphertextVectorEncryptionEngine<GlweSecretKey64, PlaintextVector64, GlweSeededCiphertextVector64> for DefaultEngine
Description:
Implementation of GlweSeededCiphertextVectorEncryptionEngine
for DefaultEngine
that
operates on 64 bits integers.