Skip to content

Conversation

bartonjs
Copy link
Member

Summary

Updates the code in the [SymmetricAlgorithm].Create samples.

  • Removes the samples from the Create(string) overload
    • The method is being marked as Obsolete in .NET 7
    • It had a different sample than Create() for C#, but reused the Create() sample in VB and C++/CLI
  • Fixes the bug in the sample that assumed CryptoStream.Read aggressively fills the destination.
  • Adds using statements (or the language-specific equivalent) for all IDisposable values.
  • Uses names for parameters and locals that are consistent with .NET guidelines and best practices.
  • Changes C++/CLI to use function prototypes so the functions are presented in the same order across all three languages.
  • Changes the method declarations in VB to a more canonical style.

Contributes to #8140. (Will update to "Fixes" after doing 3DES and RC2, once DES gets vetted first)

@bartonjs bartonjs requested a review from a team as a code owner July 15, 2022 23:21
@ghost ghost assigned bartonjs Jul 15, 2022
@ghost ghost added the area-System.Security Issues related to security practices for .NET developers. label Jul 15, 2022
@ghost
Copy link

ghost commented Jul 15, 2022

Tagging subscribers to this area: @dotnet/area-system-security, @vcsjones
See info in area-owners.md if you want to be subscribed.

Issue Details

Summary

Updates the code in the [SymmetricAlgorithm].Create samples.

  • Removes the samples from the Create(string) overload
    • The method is being marked as Obsolete in .NET 7
    • It had a different sample than Create() for C#, but reused the Create() sample in VB and C++/CLI
  • Fixes the bug in the sample that assumed CryptoStream.Read aggressively fills the destination.
  • Adds using statements (or the language-specific equivalent) for all IDisposable values.
  • Uses names for parameters and locals that are consistent with .NET guidelines and best practices.
  • Changes C++/CLI to use function prototypes so the functions are presented in the same order across all three languages.
  • Changes the method declarations in VB to a more canonical style.

Contributes to #8140. (Will update to "Fixes" after doing 3DES and RC2, once DES gets vetted first)

Author: bartonjs
Assignees: bartonjs
Labels:

area-System.Security

Milestone: -

@opbld32

This comment was marked as outdated.

@opbld31
Copy link

opbld31 commented Jul 28, 2022

Docs Build status updates of commit 7af69c7:

✅ Validation status: passed

File Status Preview URL Details
snippets/cpp/VS_Snippets_CLR/Cryptography.DES.Create.File/CPP/fileexample.cpp ✅Succeeded View
snippets/cpp/VS_Snippets_CLR/Cryptography.DES.Create.Memory/CPP/memoryexample.cpp ✅Succeeded View
snippets/csharp/System.Security.Cryptography/DES/Create/fileexample.cs ✅Succeeded View
snippets/csharp/System.Security.Cryptography/DES/Create/fileexample1.cs ✅Succeeded
snippets/csharp/System.Security.Cryptography/DES/Create/memoryexample.cs ✅Succeeded View
snippets/csharp/System.Security.Cryptography/DES/Create/memoryexample1.cs ✅Succeeded
snippets/csharp/System.Security.Cryptography/DES/Create/project.csproj ✅Succeeded
snippets/visualbasic/VS_Snippets_CLR/Cryptography.DES.Create.File/VB/fileexample.vb ✅Succeeded View
snippets/visualbasic/VS_Snippets_CLR/Cryptography.DES.Create.File/VB/project.csproj ✅Succeeded
snippets/visualbasic/VS_Snippets_CLR/Cryptography.DES.Create.Memory/project.csproj ✅Succeeded
snippets/visualbasic/VS_Snippets_CLR/Cryptography.DES.Create.Memory/VB/memoryexample.vb ✅Succeeded View
xml/System.Security.Cryptography/DES.xml ✅Succeeded View

For more details, please refer to the build report.

Note: Broken links written as relative paths are included in the above build report. For broken links written as absolute paths or external URLs, see the broken link report.

For any questions, please:

@gewarren gewarren merged commit 16d22e9 into dotnet:main Jul 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-System.Security Issues related to security practices for .NET developers.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants