pub struct EncryptionKey<P>where
P: PkeParams,{
t_hat: NttVector<P::K>,
rho: B32,
}Expand description
An EncryptionKey provides the ability to encrypt a value so that it can only be
decrypted by the holder of the corresponding decapsulation key.
Fields§
§t_hat: NttVector<P::K>§rho: B32Implementations§
Source§impl<P> EncryptionKey<P>where
P: PkeParams,
impl<P> EncryptionKey<P>where
P: PkeParams,
Sourcepub fn encrypt(
&self,
message: &B32,
randomness: &B32,
) -> Array<u8, <P as PkeParams>::CiphertextSize>
pub fn encrypt( &self, message: &B32, randomness: &B32, ) -> Array<u8, <P as PkeParams>::CiphertextSize>
Encrypt the specified message for the holder of the corresponding decryption key, using the
provided randomness, according the K-PKE.Encrypt procedure.
Sourcepub fn as_bytes(&self) -> Array<u8, <P as PkeParams>::EncryptionKeySize>
pub fn as_bytes(&self) -> Array<u8, <P as PkeParams>::EncryptionKeySize>
Represent this encryption key as a byte array (t_hat || rho)
Sourcepub fn from_bytes(enc: &Array<u8, <P as PkeParams>::EncryptionKeySize>) -> Self
pub fn from_bytes(enc: &Array<u8, <P as PkeParams>::EncryptionKeySize>) -> Self
Parse an encryption key from a byte array (t_hat || rho)
Trait Implementations§
Source§impl<P> Clone for EncryptionKey<P>
impl<P> Clone for EncryptionKey<P>
Source§fn clone(&self) -> EncryptionKey<P>
fn clone(&self) -> EncryptionKey<P>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<P> Debug for EncryptionKey<P>
impl<P> Debug for EncryptionKey<P>
Source§impl<P> Default for EncryptionKey<P>
impl<P> Default for EncryptionKey<P>
Source§fn default() -> EncryptionKey<P>
fn default() -> EncryptionKey<P>
Returns the “default value” for a type. Read more
Source§impl<P> PartialEq for EncryptionKey<P>
impl<P> PartialEq for EncryptionKey<P>
impl<P> StructuralPartialEq for EncryptionKey<P>where
P: PkeParams,
Auto Trait Implementations§
impl<P> Freeze for EncryptionKey<P>
impl<P> RefUnwindSafe for EncryptionKey<P>
impl<P> Send for EncryptionKey<P>
impl<P> Sync for EncryptionKey<P>
impl<P> Unpin for EncryptionKey<P>
impl<P> UnwindSafe for EncryptionKey<P>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more