Skip to content

Conversation

@scott-xu
Copy link
Collaborator

@scott-xu scott-xu commented Dec 28, 2024

Create a dedicated AesCtrCipher class just like AesGcmCipher class.

Relate to #1560

@scott-xu scott-xu marked this pull request as ready for review December 28, 2024 01:51
@Rob-Hague
Copy link
Collaborator

Is there a benefit to this?

@scott-xu
Copy link
Collaborator Author

FYI: some previous discussion: #865 (comment)

@scott-xu
Copy link
Collaborator Author

The main purpose is to use BCL as possible as it can.

@Rob-Hague
Copy link
Collaborator

Thanks, I remember the previous discussion, but I don't think it is worth changing the API right now. Maybe at a later time

@scott-xu scott-xu marked this pull request as draft May 5, 2025 09:28
@scott-xu scott-xu marked this pull request as ready for review May 5, 2025 12:23
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the cipher implementation to use the BCL CipherMode enum instead of a custom AesCipherMode enum, and creates a dedicated AesCtrCipher class similar to the existing AesGcmCipher class. The changes remove support for DES-EDE3-CFB encryption and eliminate custom cipher mode implementations in favor of BCL-provided functionality.

  • Replaced custom AesCipherMode enum with BCL's System.Security.Cryptography.CipherMode
  • Created dedicated AesCtrCipher class for CTR mode encryption
  • Removed DES-EDE3-CFB support and associated test data
  • Simplified cipher implementations by removing custom mode classes (CFB, CTR, OFB, CBC)

Reviewed Changes

Copilot reviewed 33 out of 33 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/Renci.SshNet/Security/Cryptography/Ciphers/AesCipher.cs Refactored to use BCL CipherMode and simplified implementation
src/Renci.SshNet/Security/Cryptography/Ciphers/AesCtrCipher.cs New dedicated class for AES-CTR mode
src/Renci.SshNet/Security/Cryptography/Ciphers/TripleDesCipher.cs Refactored to use BCL CipherMode
src/Renci.SshNet/PrivateKeyFile.*.cs Updated cipher instantiation to use BCL CipherMode
src/Renci.SshNet/ConnectionInfo.cs Updated cipher configurations to use new class constructors
test/**/*CipherTest*.cs Updated tests to use BCL CipherMode and new AesCtrCipher class
Multiple cipher mode files Removed custom implementations (CFB, CTR, OFB, CBC, CipherMode base)
test/Data/Key.RSA.Encrypted.Des.Ede3.CFB.* Removed test data for unsupported DES-EDE3-CFB

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@scott-xu
Copy link
Collaborator Author

scott-xu commented Nov 8, 2025

Is there a benefit to this?

One other benefit is the reduction of code. Less code means less maintenance.
image

@scott-xu
Copy link
Collaborator Author

scott-xu commented Nov 8, 2025

IMHO, SSH.NET should be the client of SSH but not a cryptography library. That's the reason why I hide AesCipher and TripleDesCipher.

… class; Create a dedicated AesCtrCipher class just like AesGcmCipher class.
@scott-xu
Copy link
Collaborator Author

scott-xu commented Nov 8, 2025

Could you please have another review of this PR please? @Rob-Hague

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants