traits icon indicating copy to clipboard operation
traits copied to clipboard

Simplify KEM API

Open rozbb opened this issue 1 year ago • 0 comments

This is neat. So per our conversation in https://github.com/RustCrypto/traits/issues/1508, I simplified everything down to two traits which are highly generic. Some benefits:

  1. Way clearer what's going on
  2. No need to make our own SharedSecret type, or any type for that matter
  3. Removed need for std feature
  4. Removed need for generic_array at all (now we don't need to migrate to hybrid-array at this level)
  5. You can still do authenticated encap/decap! All you need is to make you Encapsulate struct have an identity privkey, and your Decapsulate struct have an identity pubkey. The X3DH example in tests/ shows this isn't hard.

One small nit, because I know we've talked about it before: what's the now preferred way to do RNGs? It was between mut rng: impl CryptoRngCore or rng: &mut impl CryptoRngCore + ?Sized.

cc @bifurcation

rozbb avatar Feb 16 '24 19:02 rozbb