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§

source

type EncappedKeySize: ArrayLength<u8>

The size, in bytes, of an encapsulated key.

source

type SharedSecretSize: ArrayLength<u8>

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

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

Required Methods§

source

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

Parses an encapsulated key from its byte representation.

Provided Methods§

source

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.

Implementors§