pub trait ExpandedKeyEncoding: Sized {
type EncodedSize: ArraySize;
// Required methods
fn from_expanded_bytes(
enc: &Array<u8, Self::EncodedSize>,
) -> Result<Self, InvalidKey>;
fn to_expanded_bytes(&self) -> Array<u8, Self::EncodedSize>;
}use DecapsulationKey::from_seed instead
Expand description
DEPRECATED: support for encoding and decoding DecapsulationKeys in the legacy expanded form,
as opposed to the more widely adopted Seed form.
The expanded encoding format is problematic for several reasons, notably they need to validated whereas generation from seeds is always correct, meaning there is no performance advantage to using them, only additional complexity.
They are significantly larger than seeds (which are 64-bytes) and their sizes vary depending on security level whereas the size of a seed is constant:
- ML-KEM-512: 1632 bytes
- ML-KEM-768: 2400 bytes
- ML-KEM-1024: 3168 bytes
Many ML-KEM libraries have dropped support for this format entirely.
Required Associated Types§
Sourcetype EncodedSize: ArraySize
👎Deprecated since 0.3.0: use DecapsulationKey::from_seed instead
type EncodedSize: ArraySize
use DecapsulationKey::from_seed instead
The size of an expanded decapsulation key.
Required Methods§
Sourcefn from_expanded_bytes(
enc: &Array<u8, Self::EncodedSize>,
) -> Result<Self, InvalidKey>
👎Deprecated since 0.3.0: use DecapsulationKey::from_seed instead
fn from_expanded_bytes( enc: &Array<u8, Self::EncodedSize>, ) -> Result<Self, InvalidKey>
use DecapsulationKey::from_seed instead
Parse a DecapsulationKey from its legacy expanded form.
§Errors
- If the key fails to validate successfully.
Sourcefn to_expanded_bytes(&self) -> Array<u8, Self::EncodedSize>
👎Deprecated since 0.3.0: use DecapsulationKey::from_seed instead
fn to_expanded_bytes(&self) -> Array<u8, Self::EncodedSize>
use DecapsulationKey::from_seed instead
Serialize a DecapsulationKey to its legacy expanded form.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.