Ciphertext

Struct Ciphertext 

Source
pub struct Ciphertext(/* private fields */);
Expand description

The ciphertext computed by the encapsulator.

Implementations§

Source§

impl Ciphertext

Source

pub fn as_array(&self) -> &[u8; 96]

Trait Implementations§

Source§

impl AsRef<[u8]> for Ciphertext

Source§

fn as_ref(&self) -> &[u8]

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Debug for Ciphertext

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'sk> Decapsulator<Ciphertext> for SecretKey<'sk>

Available on crate feature kem only.
Source§

fn try_decap( &self, ciphertext: &Ciphertext, ) -> Result<SharedSecret<Ciphertext>, Error>

Attempt to decapsulate the given encapsulated key. Returns the shared secret on success, or an error if something went wrong.
Source§

impl EncappedKey for Ciphertext

Available on crate feature kem only.
Source§

type EncappedKeySize = UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B1>, B0>, B0>, B0>, B0>, B0>

The size, in bytes, of an encapsulated key.
Source§

type SharedSecretSize = UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>

The size, in bytes, of the shared secret that this KEM produces.
Source§

type SenderPublicKey = ()

Represents the identity key of an encapsulator. This is used in authenticated decapsulation.
Source§

type RecipientPublicKey = PublicKey<'static>

The public key of a decapsulator. This is used in encapsulation.
Source§

fn from_bytes( bytes: &GenericArray<u8, Self::EncappedKeySize>, ) -> Result<Self, Error>

Parses an encapsulated key from its byte representation.
Source§

fn as_bytes(&self) -> &GenericArray<u8, Self::EncappedKeySize>

Borrows a byte slice representing the serialized form of this encapsulated key.
Source§

impl Encapsulator<Ciphertext> for ClassicMcEliece

Source§

fn try_encap<R: CryptoRng + RngCore>( &self, csprng: &mut R, recip_pubkey: &<Ciphertext as EncappedKey>::RecipientPublicKey, ) -> Result<(Ciphertext, SharedSecret<Ciphertext>), Error>

Attempts to encapsulate a fresh shared secret with the given recipient. The resulting shared secret is bound to the identity encoded in Self (i.e., authenticated wrt Self). If Self is empty, then this is equivalent to unauthenticated encapsulation. Returns the shared secret and encapsulated key on success, or an error if something went wrong.
Source§

impl From<[u8; 96]> for Ciphertext

Source§

fn from(data: [u8; 96]) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.