Skip to content

Commit 18fef98

Browse files
authored
kem: bound Encapsulate on TryKeyInit + KeyExport (#2215)
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.
1 parent ee5e408 commit 18fef98

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

kem/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88
#![forbid(unsafe_code)]
99
#![warn(missing_docs, unused_qualifications, missing_debug_implementations)]
1010

11-
pub use crypto_common::{Generate, KeyInit, KeySizeUser, typenum::consts};
11+
pub use crypto_common::{Generate, KeyExport, KeySizeUser, TryKeyInit, typenum::consts};
1212

1313
use rand_core::TryCryptoRng;
1414

1515
/// Encapsulator for shared secrets.
1616
///
1717
/// Often, this will just be a public key. However, it can also be a bundle of public keys, or it
1818
/// can include a sender's private key for authenticated encapsulation.
19-
pub trait Encapsulate<EK, SS> {
19+
pub trait Encapsulate<EK, SS>: TryKeyInit + KeyExport {
2020
/// Encapsulation error
2121
type Error: core::error::Error;
2222

0 commit comments

Comments
 (0)