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

Implement XChaCha20Poly1305 #5

Closed

Conversation

dustinsoftware
Copy link

This is identical to ChaCha20Poly1305, just with a larger nonce size. Support already exists in libsodium for this cipher.

This is identical to ChaCha20Poly1305, just with a larger nonce size. Support already exists in libsodium for this cipher.
@dustinsoftware
Copy link
Author

Hmm.. not sure why the Ubuntu build failed. Looks like the Appveyor build was fine.

dustinsoftware pushed a commit to dustinsoftware/Paseto.Net that referenced this pull request Mar 7, 2018
@ektrah
Copy link
Owner

ektrah commented Mar 9, 2018

The first pull request – thank you very much!

XChaCha20-Poly1305 is an AEAD algorithm that seems to have some nice properties. But it's really obscure. There's no specification, no test vectors, nothing. For this reason, I'm hesitant to add it to the NSec portfolio; see briansmith/ring#411 for a similar discussion.

I do recognize the need for compatibility with specs that have decided to build on it nevertheless, though. I'm therefore thinking about something like a "libsodium compatibility pack" that includes algorithms like this and XSalsa20-Poly1305 (#2). But I don't have plans to work on that anytime soon.

Right now, I would accept this pull request only as experimental code that lives in the NSec repository but doesn't get included in releases. It would then later be moved into the compatibility pack.

@dustinsoftware
Copy link
Author

Thanks for the reply. A compatibility pack would probably be fine. I'm interested in referencing it from another library I'm developing here which needs to use that algorithm.

Per the libsodium docs it looks like this is the recommended algorithm to use if you have the option to, so I'm curious if it will become less obscure over time.

... For this reason, and if interoperability with other libraries is not a concern, this is the recommended AEAD construction.

@ektrah
Copy link
Owner

ektrah commented Mar 21, 2018

OK, let's bring this into shape and merge it into the experimental code area. I've made a few changes to the base classes in the meantime; the easiest way to update this code is probably to revert the changes and start fresh: copy src/Cryptography/ChaCha20Poly1305.cs to src/Experimental/Sodium/XChaCha20Poly1305.cs, copy src/Interop/Interop.ChaCha20Poly1305.cs to src/Interop/Interop.XChaCha20Poly1305.cs, and replace all occurrences of crypto_aead_chacha20poly1305 with crypto_aead_xchacha20poly1305 in both files. Don't bother with tests for now; just add the class to tests/Registry.cs to get some basic sanity checking.

@ektrah
Copy link
Owner

ektrah commented Apr 7, 2018

Added to NSec.Experimental in dd9ec75

@ektrah ektrah closed this Apr 7, 2018
@dustinsoftware
Copy link
Author

dustinsoftware commented Apr 7, 2018 via email

Repository owner locked and limited conversation to collaborators Apr 27, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants