Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API support for AAD? #169

Closed
kdenhartog opened this issue Jul 19, 2019 · 1 comment
Closed

API support for AAD? #169

kdenhartog opened this issue Jul 19, 2019 · 1 comment
Labels

Comments

@kdenhartog
Copy link

Is it possible to add an API that supports the use of authenticated additional data? We're looking to implement JWEs based on this library, but the use of the protected header is making it not possible. What would be the best approach to handle this?

@dchest
Copy link
Owner

dchest commented Jul 19, 2019

Unfortunately, NaCl doesn't have a defined AEAD construction, only AE (XSalsa20Poly1305). You can try ChaCha20Poly1305 AEAD (e.g. @stablelib/chacha20poly1305), but note that its nonce is short (12 bytes), so you may want XChaChaPoly https://download.libsodium.org/doc/secret-key_cryptography/aead/chacha20-poly1305 if using a random nonce.

Sometimes, for short headers people just include a copy of them in the encrypted data, and then compare them after decryption with the attached plain-text headers, but this is riskier and I don't think would work very well for JWE.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants