Struct sm9::Sm9EncappedKey
source · pub struct Sm9EncappedKey(/* private fields */);Trait Implementations§
source§impl AsRef<[u8]> for Sm9EncappedKey
impl AsRef<[u8]> for Sm9EncappedKey
source§impl Debug for Sm9EncappedKey
impl Debug for Sm9EncappedKey
source§impl Decapsulator<Sm9EncappedKey> for UserPrivateKey
impl Decapsulator<Sm9EncappedKey> for UserPrivateKey
source§fn try_decap(
&self,
encapped_key: &Sm9EncappedKey
) -> Result<SharedSecret<Sm9EncappedKey>, Error>
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
impl EncappedKey for Sm9EncappedKey
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>
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
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>>
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>
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>
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
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>
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§
impl RefUnwindSafe for Sm9EncappedKey
impl Send for Sm9EncappedKey
impl Sync for Sm9EncappedKey
impl Unpin for Sm9EncappedKey
impl UnwindSafe for Sm9EncappedKey
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