Comments (3)
I think that's an OK idea. In addition to your use case, one could also envision an application wanting to keep long-lived contexts, and thus needing to write them to persistent storage. The idea of the isolation in the API is just to keep things private by default, so an explicit "export" operation doesn't seem to violate that constraint.
Couple of thoughts:
- Whatever you do for
DecryptContext
, please also do forEncryptContext
, just for symmetry. - In a similar vein, please have the serialized version specify whether it is for encryption or decryption
- Likewise, please implement deserialization as well as serialization.
- Have you thought of which of the following approaches you would use?
- Defining serialization in this module
- Providing calling code with a struct that it could then serialize
- On the one hand, I'm not crazy about (2) because it creates some ambiguity between the serializable struct and the real struct, and almost completely eliminates the barriers to accessing context internals.
- On the other hand, (1) forces us to make a decision about which serialization(s) to support, which isn't really the point of this library. If there were a standard serialization, (1) would be a no-brainer, but there isn't. Maybe we should define one?
Net of the above, I think my bid might be to do (1) with a TLS struct as the serialization. At least two consumers of HPKE (TLS/ECH and MLS) will already have TLS syntax encoding and decoding machinery. Something like this would be easy to do with https://github.com/cisco/go-tls-syntax:
enum {
encrypt(0),
decrypt(1),
(255)
} Direction;
struct {
Direction direction;
uint16 aead_id;
opaque key<0..255>;
opaque base_nonce<0..255>;
uint64 seq;
} HPKEContext;
from go-hpke.
I'd prefer (1) as well, and I'm happy to implement it as you describe. I'll start working on this today. Thanks!
from go-hpke.
Hey @bifurcation, #39 is ready for review.
from go-hpke.
Related Issues (6)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from go-hpke.