Skip to content

kem: bound Encapsulate on TryKeyInit + KeyExport#2215

Merged
tarcieri merged 1 commit intomasterfrom
kem/encapsulate-serialization-bounds
Jan 22, 2026
Merged

kem: bound Encapsulate on TryKeyInit + KeyExport#2215
tarcieri merged 1 commit intomasterfrom
kem/encapsulate-serialization-bounds

Conversation

@tarcieri
Copy link
Copy Markdown
Member

The Encapsulate trait is for KEM public keys, which we need to be able to serialize/deserialize for them to be useful.

We don't want to enforce a similar bound for Decapsulate though, since those are secret keys that may be stored in an HSM/SEP/TPM which prevents export.

The `Encapsulate` trait is for KEM public keys, which we need to be able
to serialize/deserialize for them to be useful.

We don't want to enforce a similar bound for `Decapsulate` though, since
those are secret keys that may be stored in an HSM/SEP/TPM which
prevents export.
@tarcieri tarcieri merged commit 18fef98 into master Jan 22, 2026
10 checks passed
@tarcieri tarcieri deleted the kem/encapsulate-serialization-bounds branch January 22, 2026 18:32
tarcieri added a commit to RustCrypto/KEMs that referenced this pull request Jan 23, 2026
Also adds a `KeySizeUser` impl.

This is a companion PR to RustCrypto/traits#2215 which added a bound to
the `Encapsulate` trait for `TryKeyInit + KeyExport` from
`crypto-common`.

These traits both have a supertrait bound on `KeySizeUser`, which
defines an `ArraySize` for a fixed-size key.

The other two provide common traits for fallible decoding and encoding
respectively, where the former uses the common `InvalidKey` type also
defined in the `crypto-common` crate.

This was one big missing gap for generic KEM use.

Some traits we need aren't being re-exported from `kem` and it doesn't
do a re-export of `crypto-common` so this has a few TODOs to follow up
on that. We need to get this landed first though.
tarcieri added a commit to RustCrypto/KEMs that referenced this pull request Jan 23, 2026
Also adds a `KeySizeUser` impl.

This is a companion PR to RustCrypto/traits#2215 which added a bound to
the `Encapsulate` trait for `TryKeyInit + KeyExport` from
`crypto-common`.

These traits both have a supertrait bound on `KeySizeUser`, which
defines an `ArraySize` for a fixed-size key.

The other two provide common traits for fallible decoding and encoding
respectively, where the former uses the common `InvalidKey` type also
defined in the `crypto-common` crate.

This was one big missing gap for generic KEM use.

Some traits we need aren't being re-exported from `kem` and it doesn't
do a re-export of `crypto-common` so this has a few TODOs to follow up
on that. We need to get this landed first though.
tarcieri added a commit to RustCrypto/KEMs that referenced this pull request Jan 23, 2026
Also adds a `KeySizeUser` impl.

This is a companion PR to RustCrypto/traits#2215 which added a bound to
the `Encapsulate` trait for `TryKeyInit + KeyExport` from
`crypto-common`.

These traits both have a supertrait bound on `KeySizeUser`, which
defines an `ArraySize` for a fixed-size key.

The other two provide common traits for fallible decoding and encoding
respectively, where the former uses the common `InvalidKey` type also
defined in the `crypto-common` crate.

This was one big missing gap for generic KEM use.

Some traits we need aren't being re-exported from `kem` and it doesn't
do a re-export of `crypto-common` so this has a few TODOs to follow up
on that. We need to get this landed first though.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant