Struct sm9::Sm9EncappedKey

source ·
pub struct Sm9EncappedKey(/* private fields */);

Trait Implementations§

source§

impl AsRef<[u8]> for Sm9EncappedKey

source§

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

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

impl Debug for Sm9EncappedKey

source§

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

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

impl Decapsulator<Sm9EncappedKey> for UserPrivateKey

source§

fn try_decap( &self, encapped_key: &Sm9EncappedKey ) -> Result<SharedSecret<Sm9EncappedKey>, 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 Sm9EncappedKey

§

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

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

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

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

type SenderPublicKey = MasterPublicKey

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

type RecipientPublicKey = GenericArray<u8, UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, B0>>

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<Sm9EncappedKey> for <Sm9EncappedKey as EncappedKey>::SenderPublicKey

source§

fn try_encap<R: RngCore + CryptoRng>( &self, csprng: &mut R, recip_pubkey: &<Sm9EncappedKey as EncappedKey>::RecipientPublicKey ) -> Result<(Sm9EncappedKey, SharedSecret<Sm9EncappedKey>), 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.

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

§

type Output = T

Should always be Self
source§

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

§

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>,

§

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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V