RustCrypto: Key Encapsulation Mechanisms (KEMs)
This crate provides a common set of traits for key encapsulation mechanisms—algorithms for non-interactively establishing secrets between peers. This is intended to be implemented by libraries which produce or contain implementations of key encapsulation mechanisms, and used by libraries which want to produce or consume encapsulated secrets while generically supporting any compatible backend.
The crate exposes two traits, Encapsulate and Decapsulate, which are both generic over the encapsulated key type and the shared secret type. They are also agnostic about the structure of Self. For example, a simple Saber implementation may just impl Encapsulate for a single public key:
// Must make a newtype to implement the trait
;
And on the other end of complexity, an X3DH implementation might impl Encapsulate for a public key bundle plus a sender identity key:
// Encap context is the recipient's pubkeys and the sender's identity key
;
License
Licensed under either of
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.