sshnet / sshnet/SSH.NET

Consider dropping hand-written cipher modes

Open
#1,560 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
4.4k
Forks
993
Avg merge
9d 21h
Merged PRs (30d)
1

Description

We could consider dropping hand-written cipher modes in the library.

  1. CbcCipherMode will not be used anymore once PR https://github.com/sshnet/SSH.NET/pull/1546 is merged.
  2. CfbCipherMode is only used for PKCS1 private key encrypted byDES-EDE3-CFB. Suggest user switching to newer encryption method.
  3. OfbCipherMode is not used anywhere inside the library.
  4. CtrCipherMode is used for AesCipher. We can create a dedicated class AesCtrCipher, just like AesGcmCipher.

With all above concrete classes removed, we can remove the abstract class CipherMode. We can also remove AesCipherMode enum (renamed as BlockCipherMode in PR https://github.com/sshnet/SSH.NET/pull/1546) and use BCL's CipherMode enum.

Then AesCipher.BlockImpl can be removed, AesCipher.CtrImpl can be removed (moved to a dedicated class per above suggestion).
AesCipher.BclImpl can be removed so that AesCipher can have a pure BCL implementation (without nested Impl classes)

So does the TripleDesCipher.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review PR 1546 first to confirm which cipher-mode changes it already covers. Then trace the usages of CbcCipherMode, CfbCipherMode, OfbCipherMode, CtrCipherMode, CipherMode, AesCipher and TripleDesCipher, including the PKCS1 private-key path. Done means unused hand-written modes and obsolete implementations or enums are removed without leaving required AES-CTR or TripleDES behavior unsupported.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
cryptography
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.