Replies: 2 comments 6 replies
-
"boxes" is something sodium invented, but never standardized. It's a mess. Since the package is 0-deps and limited to ciphers, it only supports secretbox. For an example of similar standardized effort, take a glance at HPKE RFC9180. As mentioned in the README, those are equivalent: import { xsalsa20poly1305 } from '@noble/ciphers/salsa';
import { secretbox } from '@noble/ciphers/salsa'; // == xsalsa20poly1305 The implementation is as follows: Lines 175 to 178 in 68c5250 |
Beta Was this translation helpful? Give feedback.
4 replies
-
For the simple "hybrid" encryption, besides standard rfc9180, you can use something like this: const sharedKey = hkdf(x25519(privA, pubB), undefined, 'my-app', 32);
const nonce = randomBytes(32);
const cipher = xchacha20poly1305(sharedKey, nonce); // or xsalsa
cipher.encrypt(data); |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I see this quote on the README:
A couple of questions:
Sodium uses the term "secretbox" (
crypto_secretbox_easy(..)
andcrypto_secretbox_easy_open(..)
) for its symmetric authenticated encryption (same key for encryption/decryption). Further, they use the term "box" (crypto_box_easy(..)
andcrypto_box_easy_open(..)
) for their asymmetric authenticated encryption (by generating an ephemeral keypair).But they use "sealedbox" (
crypto_seal(..)
andcrypto_seal_open(..)
) terminology for its un-authenticated (anonymous) asymmetric encryption/decryption.Do you support (have aliases for) all three of these: "secretbox", "box", and "sealedbox"? Or only some of them?
Where specifically on the noble-ciphers API are these various "seal / open method" aliases located? I couldn't find them.
My desired goal is to do the "sealedbox" equivalent with Noble, from this Sodium-using code:
I'm trying to figure out if these aliases already exist, or if the pieces are there in Noble (Ciphers, etc) to do the equivalent operations, specifically where values would be interchangeable between a Sodium-using implementation and a Noble-using implementation.
Any thoughts/tips/guidance are appreciated.
Beta Was this translation helpful? Give feedback.
All reactions