Trait sm9::EncappedKey
source · pub trait EncappedKey: AsRef<[u8]> + Debug + Sized {
type EncappedKeySize: ArrayLength<u8>;
type SharedSecretSize: ArrayLength<u8>;
type SenderPublicKey;
type RecipientPublicKey;
// Required method
fn from_bytes(
bytes: &GenericArray<u8, Self::EncappedKeySize>
) -> Result<Self, Error>;
// Provided method
fn as_bytes(&self) -> &GenericArray<u8, Self::EncappedKeySize> { ... }
}Expand description
Trait impl’d by concrete types that represent an encapsulated key. This is intended to be, in essence, a bag of bytes.
Required Associated Types§
sourcetype EncappedKeySize: ArrayLength<u8>
type EncappedKeySize: ArrayLength<u8>
The size, in bytes, of an encapsulated key.
The size, in bytes, of the shared secret that this KEM produces.
sourcetype SenderPublicKey
type SenderPublicKey
Represents the identity key of an encapsulator. This is used in authenticated decapsulation.
sourcetype RecipientPublicKey
type RecipientPublicKey
The public key of a decapsulator. This is used in encapsulation.
Required Methods§
sourcefn 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.
Provided Methods§
sourcefn 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.
Object Safety§
This trait is not object safe.