-
-
Notifications
You must be signed in to change notification settings - Fork 933
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
Add support for AEAD ChaCha20Poly1305 Cipher #1416
Conversation
Note: It does not work currently. (That's why it is still in draft) output from server:
|
'padding_length', 'payload', and 'random padding' MUST be a multiple of the cipher block size or 8, whichever is larger. See https://www.rfc-editor.org/rfc/rfc4253#section-6
Another option would be to try it against the BC branch #1370 |
Yes, we can leverage BC if the final decision is to ref BC as the dependent nuget package. |
I've looked at this, it's cool that you got it working, but to be honest I am not comfortable in reviewing and signing off on an encryption implementation |
I've reviewed this PR and overall it looks great. For me, we can merge it as is or wait for #1370 (comment) |
#1370 is merged. |
… into chacha20-poly1305
… into chacha20-poly1305
// First block is not encrypted in AES GCM mode. | ||
if (_serverCipher is not null | ||
#if NET6_0_OR_GREATER | ||
and not Security.Cryptography.Ciphers.AesGcmCipher | ||
#endif | ||
) | ||
{ | ||
firstBlock = _serverCipher.Decrypt(firstBlock); | ||
_serverCipher.SetSequenceNumber(_inboundPacketSequence); | ||
|
||
// First block is not encrypted in ETM mode. | ||
if (_serverMac == null || !_serverEtm) | ||
{ | ||
plainFirstBlock = _serverCipher.Decrypt(firstBlock); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This whole method makes me shed a tear. Maybe one day we can design something easier to comprehend. I have a bit of an idea
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's becoming "nobody knows why but it just works" 🤣
Looking forward your idea.
Co-authored-by: Rob Hague <rob.hague00@gmail.com>
appveyor.yml
Outdated
|
||
test_script: | ||
- sh: echo "Run unit tests" | ||
- sh: dotnet test -f net8.0 -c Debug --no-restore --no-build --results-directory artifacts --logger Appveyor --logger "console;verbosity=normal" --logger "liquid.md;LogFileName=linux_unit_test_net_8_report.md" -p:CollectCoverage=true -p:CoverletOutputFormat=cobertura -p:CoverletOutput=../../artifacts/linux_unit_test_net_8_coverage.xml test/Renci.SshNet.Tests/Renci.SshNet.Tests.csproj | ||
- sh: echo "Run integration tests" | ||
- sh: dotnet test -f net8.0 -c Debug --no-restore --no-build --results-directory artifacts --logger Appveyor --logger "console;verbosity=normal" --logger "liquid.md;LogFileName=linux_integration_test_net_8_report.md" -p:CollectCoverage=true -p:CoverletOutputFormat=cobertura -p:CoverletOutput=../../artifacts/linux_integration_test_net_8_coverage.xml test/Renci.SshNet.IntegrationTests/Renci.SshNet.IntegrationTests.csproj | ||
- sh: dotnet test -f net48 -c Debug --no-restore --no-build --results-directory artifacts --logger Appveyor --logger "console;verbosity=normal" --logger "liquid.md;LogFileName=linux_integration_test_net_48_report.md" -p:CollectCoverage=true -p:CoverletOutputFormat=cobertura -p:CoverletOutput=../../artifacts/linux_integration_test_net_48_coverage.xml --filter Name=ChaCha20Poly1305 test/Renci.SshNet.IntegrationTests/Renci.SshNet.IntegrationTests.csproj |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the .NET Framework integration tests do actually work on linux/mono, I think we should just run the whole suite, but we can test it in another PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM if CI passes
This PR adds support for chacha20-poly1305@openssh.com described in https://datatracker.ietf.org/doc/html/draft-josefsson-ssh-chacha20-poly1305-openssh-00
Resolves #1356