rozbb / rust-hpke

An implementation of the HPKE hybrid encryption standard (RFC 9180)
Other
62 stars 31 forks source link

How to reuse AeadCtx$ and save in a collection or a better recommended approach? #71

Closed jcdc404 closed 2 days ago

jcdc404 commented 3 days ago

I am trying to write an application that keeps multiple connections open that are encrypted initiated by hpke. I would like to keep a collection of the contexts, so that I do not have to negotiate a new context for each message from each side. I cannot figure out how I can do that with the given API. Is there a recommended approach that I am not seeing.

Thanks!

rozbb commented 3 days ago

Can you make a HashMap mapping sessions to contexts? Or are you saying that doesn’t work?

jcdc404 commented 2 days ago

Can you make a HashMap mapping sessions to contexts? Or are you saying that doesn’t work?

I was having a hard time making it work. The issue was the overlapping names (for example Kem) and having to specify the associated types. Seems to be working now that I've got all that worked out.