Giter VIP home page Giter VIP logo

Comments (3)

bifurcation avatar bifurcation commented on September 20, 2024

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 for EncryptContext, 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?
    1. Defining serialization in this module
    2. 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.

cjpatton avatar cjpatton commented on September 20, 2024

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.

cjpatton avatar cjpatton commented on September 20, 2024

Hey @bifurcation, #39 is ready for review.

from go-hpke.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.