This makes it easier to reason about Key instances in e.g.
DigitalSignature implementations, because we know that the
Key is initialised with its data and will not change.
Co-authored-by: Wojciech Nagórski <wojtpl2@gmail.com>
* Add .NET 8.0 to current build project.
Add dependency **Microsoft.Bcl.AsyncInterfaces** for net462 and netstandard2.0 for current nuget spec
* Remove last new line
* Tabify
* Exludes the test projects from code coverage reports
* Removes MessageAttribute in favor of properties on Message class
* Benchmark for removal of MessageAttribute
This paves the way for asynchronous synchronisation via WaitAsync
(and eliminates a timing test which sometimes fails in CI)
Co-authored-by: Wojciech Nagórski <wojtpl2@gmail.com>
* Updates .gitignore to exclude test results
* Adds .editorconfig for xml, csproj, and props files
Formats xml, csproj, and props files
* Hides stylecop.json from Solution Explorer projects
* 🐛 AsyncResult contains invalid value
- AsyncResult should contain invalid value immediately after async operation is marked as completed
- there was race condition problems with callback method which is invoked on different thread so updating of value is done without any synchronization. So in some cases async operation is marked as completed but async result value is not yet updated and contains invalid value
* Revert test
---------
Co-authored-by: Miroslav Pokorný <m.pokorny@quadient.com>
* Add support for .NET 8.0
* Fix CA1512: Use 'ArgumentOutOfRangeException.ThrowIfNegative' instead of explicitly throwing a new exception instance (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1512)
* Use `ThrowIfGreaterThan` instead of `ThrowIfNegative`+calculation, to supply the correct parameter name.
* .NET 8 is faster :-)
* Use the explicit version, in case newer version SDK breaks our tests
* Add FEATURE_AES_CSP to use hardware-accelerated AesCryptoServiceProvider
Reduces CPU usage dramatically, allowing more performance on slower machines
* Restructure, move most of the feature code to AesCipher.cs
Fix padding for non-AES blockciphers
Fix IV exception for non-AES blockciphers
* Fix the AES Padding
It looks like the legacy code doesn't correctly remove padding, so this code needs to do the same.
* fix rebase issues
restructure AES CSP code into its own class
* Minor fixes
* Rework based on suggestions
* Move all changes to AesCypher.cs, as per Rob-Hague suggestion
Remove FEATURE_AES_CSP conditional
Fix OFB CipherMode
* update AesCipherTest.cs generator
* Fix continuous session encrypt/decrypt
(preserve IV between calls when Padding is None)
* Reduce CTR memory usage in Net 6+
Small performance increase in CTR buffer mode
Cosmetic changes
* Factor out the implementations and re-add the existing constructor
* remove ctor; revert tests; remove unused _iv member
* Reorder Encryption cipher preference list
* Remove redundant AES tests
Add tests for stream cipher state preservation
* Refactor ArrayXOR()
* Add test for IV overflow
* Performance bump for AES CTR (thanks @robhague)
* fix merge conflict
* Move AesCipherMode enum to its own file
---------
Co-authored-by: Pedro Fonseca <pfonseca@qti.qualcomm.com>
Co-authored-by: Rob Hague <rob.hague00@gmail.com>
* Data lengths longer than stream position when data lengths are greater than int.maxvalue are ignored and do not throw an exception
* Removed unreachable test
* Do not try to load the data (just ignore it)
---------
Co-authored-by: Steve Evans <sevans1@oeconnection.com>
Co-authored-by: Rob Hague <rob.hague00@gmail.com>
* Fix https://github.com/sshnet/SSH.NET/issues/1191
* Expose `SshIdentificationReceived` event so that lib consumer can adjust based on server identification
* revert unrelated code style change
* revert OpenSSH 6.6 related tests
* revert ConnectionBase
* Add unit tests
* Rename to `ServerIdentificationReceived`
* rename
* Use System.Security.Cryptography in AesCipher
* don't set the IV - it is unused by ECB
* Dispose ciphers in Session if applicable
---------
Co-authored-by: Wojciech Nagórski <wojtpl2@gmail.com>
* Make it work (it needs the TRACE symbol defined - lots of head scratching without it)
* Expose publicly, but still in DEBUG (to allow programmatic configuration necessary in Core)
* Document how to use it
* Tweak usage (add some logs, remove key/iv information, override ToString on some Message types)
Co-authored-by: Wojciech Nagórski <wojtpl2@gmail.com>
Change the data to be in 64-wide columns instead of 70, and add a newline
at the end of the file. ssh-keygen does not like it otherwise.
puttygen Key.OPENSSH.ECDSA.Encrypted.txt -O private-openssh-new -C Key.OPENSSH.ECDSA.Encrypted
puttygen Key.OPENSSH.ECDSA.txt -O private-openssh-new -C Key.OPENSSH.ECDSA
puttygen Key.OPENSSH.ECDSA384.Encrypted.txt -O private-openssh-new -C Key.OPENSSH.ECDSA384.Encrypted
puttygen Key.OPENSSH.ECDSA384.txt -O private-openssh-new -C Key.OPENSSH.ECDSA384
puttygen Key.OPENSSH.ECDSA521.Encrypted.txt -O private-openssh-new -C Key.OPENSSH.ECDSA521.Encrypted
puttygen Key.OPENSSH.ECDSA521.txt -O private-openssh-new -C Key.OPENSSH.ECDSA521
puttygen Key.OPENSSH.ED25519.Encrypted.txt -O private-openssh-new -C Key.OPENSSH.ED25519.Encrypted
puttygen Key.OPENSSH.ED25519.txt -O private-openssh-new -C Key.OPENSSH.ED25519
puttygen Key.OPENSSH.RSA.Encrypted.txt -O private-openssh-new -C Key.OPENSSH.RSA.Encrypted
puttygen Key.OPENSSH.RSA.txt -O private-openssh-new -C Key.OPENSSH.RSA
(the -C flag changes the comment, otherwise puttygen refuses to do anything)
* Increase test coverage for AesCipher
The tests were generated by a script which is also added for posterity.
The script works by running "openssl enc [...]" (via WSL) to generate the
expected encrypted values, and also verifies those values against the .NET
BCL implementation as an extra validation (it uncovered a difference in
CFB mode between the two relating to the feedback size).
* Fix OfbCipherMode
It was an exact copy of CfbCipherMode
* Fix analyzer errors in Renci.SshNet and Renci.SshNet.TestTools.OpenSSH.
Suppress all errors in unit tests and integration tests.
* Update unit tests now that we pass 'mode' as argument name when we throw ArgumentException.
* Remove stale comment and add unit tests for SshData.ReadBytes(int length).
* Remove unnessary suppression.
* Remove Visual Studio magic.
* Removed duplicate source file.
* Clarified that suppression hides a false positive.
* Remove suppressions for S2372.
* Update ReadExtensionPair() to return concrete dictionary.
* Move test projects to test folder.
Move global.json to root of repo.
Update solution items in solution.
* Move test projects to test folder.
Move global.json to root of repo.
Update solution items in solution.
Update appveyor configuration/
* Attempt to have appveyor use the correct .NET SDK.
* Update .NET SDK to version 7.0.402.
* Move Data folder below Renci.SshNet.Tests.
* Make csinst less chatty.
* Move Data folder directly below test folder as it's used by multiple test projects.
* Remove CS1591 nowarn from concrete test projects as this is already defined in the Directory.Build.props that is in the test folder.
* Fix integration test after moving test projects
---------
Co-authored-by: drieseng <gert.driesen@telenet.be>