Skip to content

Improve or remove code examples for TripleDES, DES, and RC2. #8140

@vcsjones

Description

@vcsjones

We have a number of examples for using these symmetric ciphers that I think either need to be significantly improved, or removed.

  1. They demonstrate incorrect use of CryptoStream. Ex:
    csDecrypt.Read(fromEncrypt, 0, fromEncrypt.Length);
  2. They are incomplete examples. They, for example, do not demonstrate proper nonce management, they do not demonstrate proper authentication (authentication in cryptographic terms). It would be rather hard to demonstrate how to do these things properly in short examples, and nor do I think it's something that should be in API documentation.

The CryptoStream issue doesn't apply to Aes because we don't have that example for Aes, but we do have them for the other symmetric ciphers.

If we want to keep the examples, then they need to be re-written to 1. be correct 2. use modern APIs and 3. be heavily caveated that they are incomplete examples and do not demonstrate safe examples of using symmetric encryption.

/cc @bartonjs @GrabYourPitchforks

Metadata

Metadata

Assignees

No one assigned

    Labels

    Pri3Indicates issues/PRs that are low priorityarea-System.SecurityIssues related to security practices for .NET developers.untriagedNew issue has not been triaged by the area owner

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions