pub(crate) struct EncryptionKey<P>where
P: PkeParams,{
t_hat: NttVector<BaseField, 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<BaseField, P::K>§rho: B32Implementations§
Source§impl<P> EncryptionKey<P>where
P: PkeParams,
impl<P> EncryptionKey<P>where
P: PkeParams,
Sourcepub(crate) fn encrypt(&self, message: &B32, randomness: &B32) -> Ciphertext<P>
pub(crate) fn encrypt(&self, message: &B32, randomness: &B32) -> Ciphertext<P>
Encrypt the specified message for the holder of the corresponding decryption key, using the
provided randomness, according the K-PKE.Encrypt procedure.
Sourcepub(crate) fn to_bytes(&self) -> Array<u8, <P as PkeParams>::EncryptionKeySize>
pub(crate) fn to_bytes(&self) -> Array<u8, <P as PkeParams>::EncryptionKeySize>
Represent this encryption key as a byte array (t_hat || rho)
Sourcepub(crate) fn from_bytes(
enc: &Array<u8, <P as PkeParams>::EncryptionKeySize>,
) -> Result<Self, InvalidKey>
pub(crate) fn from_bytes( enc: &Array<u8, <P as PkeParams>::EncryptionKeySize>, ) -> Result<Self, InvalidKey>
Parse an encryption key from a byte array (t_hat || rho).
§Errors
Returns InvalidKey in the event that the key fails the encapsulation key checks
specified in FIPS 203 §7.2.
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> Eq 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> UnsafeUnpin 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