Giter VIP home page Giter VIP logo

Comments (5)

jedisct1 avatar jedisct1 commented on August 26, 2024 3

Look at the documentation for the N variant. Or, if both parties already know their peer's public key, look at the KK variant. It should be pretty self-explanatory.

The KK variant requires an extra packet, but you get forward secrecy (each session will use a different shared key).

libhydrogen compiles fine to webassembly, and supports WASI. But there are no clean Javascript bindings yet.

from libhydrogen.

jedisct1 avatar jedisct1 commented on August 26, 2024

Hi,

Of course it supports public key encryption. box is a legacy API, and even in libsodium I can't think of any compelling reason to keep using it.

Look at the Key Exchange section. These functions can create key pairs, and use them to compute a shared secret. Once you have that shared secret, use it withsecretbox.

The closest construction to box (no forward secrecy, no authentication) would be the N variant without a pre-shared key + secretbox. The noise N variant without a pre-shared key is equivalent to libsodium's crypto_kx.

from libhydrogen.

NullVoxPopuli avatar NullVoxPopuli commented on August 26, 2024

ah ok, cool. So, constructing that reminds of the process for using AES with RSA.

Is there an example / test somewhere that I could reference as I play around with this?
Also, does there exist WASM bindings? ;)

from libhydrogen.

marek22k avatar marek22k commented on August 26, 2024

Of course it supports public key encryption. box is a legacy API, and even in libsodium I can't think of any compelling reason to keep using it.

Hi, I hope it's okay if I ask here: Are you referring to crypto_box_* in libsodium? Why is it legacy?

from libhydrogen.

rustonaut avatar rustonaut commented on August 26, 2024

From a educational POV it would be grate to explain why box is legacy in the libsodium documentation.

I'm not an expert in this field at all but as far as I understand:

  • NaCL crypto_box_* has some suboptimal design choices I'm not sure if @jedisct1 was referring to this

  • libsodiums crypto_box with _easy and _detached has "replaced" NaCL crypto_box_*

  • crypto_box with _easy/_detached still has a bit of sub-optimal API wrt.:

    • it doesn't use any context (i.e. neither a key derivation with context nor associated data)
    • it doesn't allow specifying a pre-shared key in the key exchange
    • it doesn't come with forward security

So by now it's not that rare to explicitly do a key exchange + a AEAD chipher for encryption passing some AD. Or to use a key exchange followed by using HKDF for generating subkeys with a specific context.

from libhydrogen.

Related Issues (20)

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.