pub struct EncryptionKey { /* private fields */ }
Expand description
A FrodoKEM public key
Implementations§
Source§impl EncryptionKey
impl EncryptionKey
Sourcepub fn from_bytes<B: AsRef<[u8]>>(
algorithm: Algorithm,
value: B,
) -> FrodoResult<Self>
pub fn from_bytes<B: AsRef<[u8]>>( algorithm: Algorithm, value: B, ) -> FrodoResult<Self>
Convert a slice of bytes into a EncryptionKey
according to the specified Algorithm
.
Sourcepub fn encapsulate_with_rng(
&self,
rng: impl CryptoRng,
) -> FrodoResult<(Ciphertext, SharedSecret)>
pub fn encapsulate_with_rng( &self, rng: impl CryptoRng, ) -> FrodoResult<(Ciphertext, SharedSecret)>
Encapsulate a random value to generate a SharedSecret
and a Ciphertext
.
Sourcepub fn encapsulate<B: AsRef<[u8]>, S: AsRef<[u8]>>(
&self,
message: B,
salt: S,
) -> FrodoResult<(Ciphertext, SharedSecret)>
pub fn encapsulate<B: AsRef<[u8]>, S: AsRef<[u8]>>( &self, message: B, salt: S, ) -> FrodoResult<(Ciphertext, SharedSecret)>
Encapsulate with given message to generate a SharedSecret
and a Ciphertext
.
NOTE: The message must be of the correct length for the algorithm.
Also, this method is deterministic, meaning that using the same message
will yield the same SharedSecret
and Ciphertext
Trait Implementations§
Source§impl AsRef<[u8]> for EncryptionKey
impl AsRef<[u8]> for EncryptionKey
Source§impl Clone for EncryptionKey
impl Clone for EncryptionKey
Source§fn clone(&self) -> EncryptionKey
fn clone(&self) -> EncryptionKey
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 ConstantTimeEq for EncryptionKey
impl ConstantTimeEq for EncryptionKey
Source§impl Debug for EncryptionKey
impl Debug for EncryptionKey
Source§impl Default for EncryptionKey
impl Default for EncryptionKey
Source§fn default() -> EncryptionKey
fn default() -> EncryptionKey
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for EncryptionKey
Available on crate feature serde
only.
impl<'de> Deserialize<'de> for EncryptionKey
Available on crate feature
serde
only.Source§fn deserialize<D>(d: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(d: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<&DecryptionKey> for EncryptionKey
impl From<&DecryptionKey> for EncryptionKey
Source§fn from(secret_key: &DecryptionKey) -> Self
fn from(secret_key: &DecryptionKey) -> Self
Converts to this type from the input type.
Source§impl PartialEq for EncryptionKey
impl PartialEq for EncryptionKey
Source§impl Serialize for EncryptionKey
Available on crate feature serde
only.
impl Serialize for EncryptionKey
Available on crate feature
serde
only.impl Eq for EncryptionKey
Auto Trait Implementations§
impl Freeze for EncryptionKey
impl RefUnwindSafe for EncryptionKey
impl Send for EncryptionKey
impl Sync for EncryptionKey
impl Unpin for EncryptionKey
impl UnwindSafe for EncryptionKey
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> ToHex for T
impl<T> ToHex for T
Source§fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
Encode the hex strict representing
self
into the result. Lower case
letters are used (e.g. f9b4ca
)Source§fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
Encode the hex strict representing
self
into the result. Upper case
letters are used (e.g. F9B4CA
)