Skip to content

Replace specific crypto algorithm recommendations with NIST-approved references#12524

Open
Copilot wants to merge 13 commits intomainfrom
copilot/fix-incorrect-security-guidelines
Open

Replace specific crypto algorithm recommendations with NIST-approved references#12524
Copilot wants to merge 13 commits intomainfrom
copilot/fix-incorrect-security-guidelines

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 16, 2026

Security warnings across the docs recommend specific algorithms (AES, SHA-256, RSA, ECDsa) as replacements for deprecated ones. These become stale as standards evolve — e.g., "use Aes (AES-256)" is already not future-proof.

All recommendations now defer to NIST SP 800-131A Rev. 2 instead of naming specific algorithms.

XML docs (~37 files)

  • Symmetric ciphers (DES, TripleDES, RC2, EncryptedXml): "use AES" → "NIST-approved symmetric encryption algorithm"
  • Hash functions (~50 instances across SignedXml, Pkcs12Builder, SecurityAlgorithmSuite, HttpHeaders, etc.): "SHA-256 or better" → "NIST-approved hash function"
  • Digital signatures (DSA family): "use RSA/ECDsa" → "NIST-approved digital signature algorithm"
  • PBKDF2 (Rfc2898DeriveBytes): "pass SHA-256 or higher" → "pass a NIST-approved hash algorithm"; iteration count updated from 1,000 → 600,000

Snippet code comments (~25 files)

  • // For new applications, use Aes (AES-256) instead.// For new applications, use a NIST-approved symmetric encryption algorithm instead.
  • // Microsoft recommends SHA256 or better.// Microsoft recommends using a NIST-approved hash function.

Pattern used

Due to collision problems with SHA-1, Microsoft recommends using a NIST-approved hash function.
Consider using a NIST-approved symmetric encryption algorithm
(see [NIST SP 800-131A Rev. 2](https://csrc.nist.gov/pubs/sp/800/131/a/r2/final)
for guidance on currently approved algorithms).

Factual statements about API defaults (e.g., "The default algorithm is CngAlgorithm.Sha256") and Rijndael→Aes migration guidance are preserved — only recommendations were changed.

Copilot AI and others added 12 commits April 15, 2026 10:00
…ryptedXml, and ASP.NET examples

- Update PBKDF2 minimum iteration count from 1000 to 600,000 per OWASP 2025
- Add OWASP reference link for iteration count guidance
- Add security note to Rfc2898DeriveBytes code snippets (C# and VB)
- Add note that TripleDES in EncryptedXml example is illustrative only
- Clarify SHA1 usage in MachineKeySection and MembershipPasswordFormat
  examples is for illustration, not recommendation

Agent-Logs-Url: https://github.com/dotnet/dotnet-api-docs/sessions/764780ef-fe2f-488d-b3b1-2622af6cb005

Co-authored-by: krwq <660048+krwq@users.noreply.github.com>
…-bit key warning, hardcoded credentials, SQL injection

- Add PBKDF1 weakness warning to PasswordDeriveBytes.xml with recommendation to use Rfc2898DeriveBytes
- Add NIST minimum key size warning to RSACryptoServiceProvider.xml for 1024-bit default
- Add "do not hardcode credentials" comments to misleading SecurelyStoredPassword snippets (C# and VB)
- Add SQL injection warning comment to DataGridView employees.cs example

Agent-Logs-Url: https://github.com/dotnet/dotnet-api-docs/sessions/1292907e-994a-4770-9f47-ba31729d934e

Co-authored-by: krwq <660048+krwq@users.noreply.github.com>
…efault, TLS 1.0/1.1 vulnerabilities, RC4 in MSMQ

- DSACryptoServiceProvider.xml: Upgrade to IMPORTANT, warn 512-1024 bit keys are insecure, recommend DSA.Create for 2048+
- Rfc2898DeriveBytes.xml: Add class-level warning about default HMAC-SHA-1 PRF, recommend SHA-256 overloads
- SecurityProtocolType.xml: Add known vulnerability warnings to Tls and Tls11 enum field summaries
- MsmqTransportSecurityElement.xml and MsmqTransportSecurity.xml: Add RC4 insecurity warning, recommend AES

Agent-Logs-Url: https://github.com/dotnet/dotnet-api-docs/sessions/5d6f4eab-cf75-4f5a-86b6-db08ca720b4d

Co-authored-by: krwq <660048+krwq@users.noreply.github.com>
…DES config provider, and WCF hardcoded credentials

Agent-Logs-Url: https://github.com/dotnet/dotnet-api-docs/sessions/75297ead-2a52-4a34-a843-db016131f9f7

Co-authored-by: krwq <660048+krwq@users.noreply.github.com>
…o algorithms and add vulnerability language to SslProtocols TLS 1.0/1.1

Agent-Logs-Url: https://github.com/dotnet/dotnet-api-docs/sessions/452aea0d-c0b7-46fe-9fbe-76242e56ebcb

Co-authored-by: krwq <660048+krwq@users.noreply.github.com>
@krwq krwq marked this pull request as ready for review April 16, 2026 11:13
@krwq krwq requested review from a team and mconnew as code owners April 16, 2026 11:13
@krwq krwq requested review from Copilot and jeffhandley April 16, 2026 11:13
@github-actions github-actions bot added the area-Meta Concerns something that extends across runtime area boundaries, for example, IDisposable. label Apr 16, 2026
Copy link
Copy Markdown
Contributor

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 updates .NET API reference documentation and snippet comments to avoid recommending specific cryptographic algorithms, instead steering readers toward NIST guidance (notably NIST SP 800-131A Rev. 2), and refreshes PBKDF2 iteration guidance.

Changes:

  • Replaces “use AES/SHA-256/RSA/ECDsa” style recommendations with “NIST-approved …” guidance across many XML docs and snippets.
  • Updates PBKDF2 (Rfc2898DeriveBytes) guidance (including minimum recommended iterations) and adds clearer security notes about defaults.
  • Adds/updates snippet safety comments (hard-coded credentials, SQL injection, deprecated/weak crypto).

Reviewed changes

Copilot reviewed 115 out of 115 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
xml/System.Workflow.ComponentModel.Compiler/WorkflowMarkupSourceAttribute.xml Switches MD5 replacement guidance to “NIST-approved hash function.”
xml/System.Web/HttpWorkerRequest.xml Updates MD5 guidance to “NIST-approved hash function.”
xml/System.Web.Security/SqlMembershipProvider.xml Updates SHA1 guidance to “NIST-approved hash function.”
xml/System.Web.Security/MembershipPasswordFormat.xml Updates SHA1 guidance and clarifies illustrative-only usage.
xml/System.Web.Configuration/MachineKeySection.xml Updates SHA1 example guidance and clarifies illustrative-only usage.
xml/System.Web.Configuration/FormsAuthPasswordFormat.xml Updates MD5/SHA1 guidance to “NIST-approved hash function.”
xml/System.ServiceModel/MsmqTransportSecurity.xml Adds RC4 insecurity warning; updates SHA-1 hash guidance to NIST-approved language.
xml/System.ServiceModel/MsmqSecureHashAlgorithm.xml Updates MD5/SHA-1 guidance to “NIST-approved hash function.”
xml/System.ServiceModel.Security/TripleDesSecurityAlgorithmSuite.xml Updates SHA-1 guidance to “NIST-approved hash function.”
xml/System.ServiceModel.Security/SecurityKeyEntropyMode.xml Updates SHA-1 guidance to “NIST-approved hash function.”
xml/System.ServiceModel.Security/Basic256SecurityAlgorithmSuite.xml Updates SHA-1 guidance to “NIST-approved hash function.”
xml/System.ServiceModel.Security/Basic192SecurityAlgorithmSuite.xml Updates SHA-1 guidance to “NIST-approved hash function.”
xml/System.ServiceModel.Security/Basic128SecurityAlgorithmSuite.xml Updates SHA-1 guidance to “NIST-approved hash function.”
xml/System.ServiceModel.Configuration/MsmqTransportSecurityElement.xml Mirrors MSMQ RC4 warning addition in configuration element docs.
xml/System.Security.Policy/Hash.xml Updates MD5/SHA-1 guidance to “NIST-approved hash function.”
xml/System.Security.Cryptography/TripleDESCryptoServiceProvider.xml Replaces AES recommendation with NIST-approved symmetric encryption guidance + NIST link.
xml/System.Security.Cryptography/TripleDESCng.xml Replaces AES recommendation with NIST-approved symmetric encryption guidance + NIST link.
xml/System.Security.Cryptography/TripleDES.xml Replaces AES recommendation with NIST-approved symmetric encryption guidance + NIST link.
xml/System.Security.Cryptography/SHA1Managed.xml Updates SHA-1 guidance to NIST-approved language + NIST link.
xml/System.Security.Cryptography/SHA1CryptoServiceProvider.xml Updates SHA-1 guidance to NIST-approved language + NIST link.
xml/System.Security.Cryptography/SHA1Cng.xml Updates SHA-1 guidance to NIST-approved language + NIST link.
xml/System.Security.Cryptography/SHA1.xml Updates SHA-1 guidance to NIST-approved language + NIST link.
xml/System.Security.Cryptography/Rfc2898DeriveBytes.xml Adds PRF/default guidance and updates minimum iteration recommendation to 600,000 with NIST references.
xml/System.Security.Cryptography/RSAEncryptionPadding.xml Updates SHA-1 guidance to NIST-approved language (NIST SP reference).
xml/System.Security.Cryptography/RSACryptoServiceProvider.xml Adds RSA key-size warning and updates hash guidance to NIST-approved language + NIST link.
xml/System.Security.Cryptography/RC2CryptoServiceProvider.xml Replaces AES recommendation with NIST-approved symmetric encryption guidance + NIST link.
xml/System.Security.Cryptography/RC2.xml Replaces AES recommendation with NIST-approved symmetric encryption guidance + NIST link.
xml/System.Security.Cryptography/PasswordDeriveBytes.xml Adds guidance to avoid PBKDF1 for new applications in favor of PBKDF2.
xml/System.Security.Cryptography/PKCS1MaskGenerationMethod.xml Updates SHA-1 guidance to NIST-approved language + NIST link.
xml/System.Security.Cryptography/MD5CryptoServiceProvider.xml Replaces specific hash recommendations with NIST-approved guidance + NIST link.
xml/System.Security.Cryptography/MD5.xml Replaces specific hash recommendations with NIST-approved guidance + NIST link.
xml/System.Security.Cryptography/KeyedHashAlgorithm.xml Updates SHA-1 guidance to NIST-approved language + NIST link.
xml/System.Security.Cryptography/HashAlgorithmName.xml Updates MD5/SHA-1 guidance to NIST-approved language + NIST link.
xml/System.Security.Cryptography/HashAlgorithm.xml Updates SHA-1 guidance to NIST-approved language + NIST link.
xml/System.Security.Cryptography/HMACSHA1.xml Updates SHA-1 guidance to NIST-approved language + NIST link.
xml/System.Security.Cryptography/HMACRIPEMD160.xml Updates MD4/MD5 guidance to NIST-approved language + NIST link.
xml/System.Security.Cryptography/HMACMD5.xml Updates MD5 guidance to NIST-approved language + NIST link.
xml/System.Security.Cryptography/HMAC.xml Updates MD5/SHA-1 guidance to NIST-approved language + NIST link.
xml/System.Security.Cryptography/ECDsaCng.xml Updates hash guidance to NIST-approved language + NIST link while retaining default algorithm fact.
xml/System.Security.Cryptography/ECDiffieHellmanCng.xml Updates hash guidance to NIST-approved language + NIST link while retaining default algorithm fact.
xml/System.Security.Cryptography/DSASignatureFormatter.xml Replaces RSA/ECDsa recommendation with NIST-approved digital signature guidance + NIST link.
xml/System.Security.Cryptography/DSASignatureFormat.xml Replaces RSA/ECDsa recommendation with NIST-approved digital signature guidance + NIST link.
xml/System.Security.Cryptography/DSASignatureDeformatter.xml Replaces RSA/ECDsa recommendation with NIST-approved digital signature guidance + NIST link.
xml/System.Security.Cryptography/DSAParameters.xml Replaces RSA/ECDsa recommendation with NIST-approved digital signature guidance + NIST link.
xml/System.Security.Cryptography/DSAOpenSsl.xml Replaces RSA/ECDsa recommendation with NIST-approved digital signature guidance + NIST link.
xml/System.Security.Cryptography/DSACryptoServiceProvider.xml Replaces RSA recommendation with NIST-approved digital signature guidance + NIST link; updates SHA-1 guidance.
xml/System.Security.Cryptography/DSACng.xml Replaces RSA/ECDsa recommendation with NIST-approved digital signature guidance + NIST link.
xml/System.Security.Cryptography/DSA.xml Replaces RSA/ECDsa recommendation with NIST-approved digital signature guidance + NIST link.
xml/System.Security.Cryptography/DESCryptoServiceProvider.xml Replaces AES recommendation with NIST-approved symmetric encryption guidance + NIST link.
xml/System.Security.Cryptography/DES.xml Strengthens DES deprecation warning and switches to NIST-approved symmetric encryption guidance + NIST link.
xml/System.Security.Cryptography/CngAlgorithm.xml Updates MD5/SHA-1 guidance to NIST-approved language (NIST SP reference).
xml/System.Security.Cryptography.Xml/SignedXml.xml Updates SHA-1 guidance to “NIST-approved hash function.”
xml/System.Security.Cryptography.Xml/Reference.xml Updates SHA-1 guidance to “NIST-approved hash function.”
xml/System.Security.Cryptography.Xml/EncryptedXml.xml Adds “illustrative only” note for TripleDES example and suggests NIST-approved symmetric encryption.
xml/System.Security.Cryptography.Pkcs/Pkcs12Builder.xml Updates SHA-1 guidance to “NIST-approved hash function.”
xml/System.Security.Authentication/SslProtocols.xml Updates TLS 1.0/1.1 summaries to note known vulnerabilities and recommend newer protocols.
xml/System.Security.Authentication/HashAlgorithmType.xml Updates MD5/SHA-1 guidance to “NIST-approved hash function.”
xml/System.Reflection/AssemblyHashAlgorithm.xml Updates MD5/SHA-1 guidance to “NIST-approved hash function.”
xml/System.Net/SecurityProtocolType.xml Updates TLS 1.0/1.1 summaries to note known vulnerabilities and recommend newer protocols.
xml/System.Net/HttpResponseHeader.xml Updates Content-MD5 guidance to “NIST-approved hash function.”
xml/System.Net/HttpRequestHeader.xml Updates Content-MD5 guidance to “NIST-approved hash function.”
xml/System.Net.Http.Headers/HttpContentHeaders.xml Updates Content-MD5 guidance to “NIST-approved hash function.”
xml/System.Messaging/Message.xml Updates MD5/SHA-1 guidance to “NIST-approved hash function.”
xml/System.Messaging/DefaultPropertiesToSend.xml Updates MD5 guidance to “NIST-approved hash function.”
xml/System.IdentityModel/RsaSignatureCookieTransform.xml Updates SHA-1 guidance to “NIST-approved hash function.”
xml/System.IdentityModel/RsaEncryptionCookieTransform.xml Updates SHA-1 guidance to “NIST-approved hash function.”
xml/System.IdentityModel.Tokens/X509AsymmetricSecurityKey.xml Updates SHA-1 guidance to “NIST-approved hash function.”
xml/System.IdentityModel.Tokens/SymmetricSecurityKey.xml Updates SHA-1 guidance to “NIST-approved hash function.”
xml/System.IdentityModel.Tokens/SecurityAlgorithms.xml Updates SHA-1 guidance to “NIST-approved hash function.”
xml/System.IdentityModel.Tokens/InMemorySymmetricSecurityKey.xml Updates SHA-1 guidance to “NIST-approved hash function.”
xml/System.IO.Packaging/PackageDigitalSignatureManager.xml Updates SHA-1 guidance to “NIST-approved hash function.”
xml/System.Configuration.Assemblies/AssemblyHashAlgorithm.xml Updates SHA-1 guidance to “NIST-approved hash function.”
xml/System.CodeDom/CodeChecksumPragma.xml Updates SHA-1/MD5 guidance to “NIST-approved hash function.”
snippets/visualbasic/VS_Snippets_WebNet/System.Configuration.ProtectedConfigurationProvider/VB/ProtectedConfigurationProviderLib.vb Adds TripleDES deprecation warning and NIST-approved guidance.
snippets/visualbasic/VS_Snippets_Data/XslCompiledTransform.Transform/VB/Xslt_Transform_v2.vb Adds guidance not to hardcode credentials and to use a secure store.
snippets/visualbasic/VS_Snippets_Data/XslCompiledTransform.Load/VB/Xslt_Load_v2.vb Adds guidance not to hardcode credentials and to use a secure store.
snippets/visualbasic/VS_Snippets_Data/XmlResolver_Samples/VB/XmlResolver_Samples.vb Adds guidance not to hardcode credentials and to use a secure store.
snippets/visualbasic/VS_Snippets_Data/XmlReader.Create/VB/XmlReader_Create.vb Adds guidance not to hardcode credentials and to use a secure store.
snippets/visualbasic/VS_Snippets_CFX/samlattribute/vb/source.vb Updates SHA1 collision guidance to NIST-approved wording.
snippets/visualbasic/VS_Snippets_CFX/s_ueclientcredentials/vb/program.vb Adds guidance not to hardcode credentials and to use a secure store.
snippets/visualbasic/System.Security.Cryptography/Rfc2898DeriveBytes/Overview/rfc28981.vb Updates PBKDF2 iteration-count comment to reference NIST SP 800-132 guidance.
snippets/visualbasic/System.Security.Cryptography/RSACryptoServiceProvider/SignHash/class1.vb Updates SHA1 collision guidance to NIST-approved wording.
snippets/visualbasic/System.Security.Cryptography/PasswordDeriveBytes/Overview/sample.vb Updates SHA1 collision guidance to NIST-approved wording.
snippets/visualbasic/System.Security.Cryptography/DESCryptoServiceProvider/Overview/source.vb Adds DES insecurity warning and NIST-approved symmetric encryption guidance.
snippets/visualbasic/System.Security.Cryptography/DESCryptoServiceProvider/CreateEncryptor/memoryexample.vb Adds DES insecurity warning and NIST-approved symmetric encryption guidance.
snippets/visualbasic/System.Security.Cryptography/DESCryptoServiceProvider/CreateEncryptor/fileexample.vb Adds DES insecurity warning and NIST-approved symmetric encryption guidance.
snippets/visualbasic/System.Security.Cryptography/DES/Create/memoryexample.vb Adds DES insecurity warning and NIST-approved symmetric encryption guidance.
snippets/visualbasic/System.Security.Cryptography/DES/Create/fileexample.vb Adds DES insecurity warning and NIST-approved symmetric encryption guidance.
snippets/visualbasic/System.Security.Cryptography/CryptoConfig/Overview/members.vb Updates SHA1 collision guidance to NIST-approved wording.
snippets/visualbasic/System.Security.Cryptography/AsymmetricAlgorithm/Overview/customcrypto.vb Updates SHA1 collision guidance to NIST-approved wording.
snippets/visualbasic/System.CodeDom/CodeChecksumPragma/Overview/codedirective.vb Updates SHA1/MD5 collision guidance to NIST-approved wording.
snippets/csharp/VS_Snippets_WebNet/System.Configuration.ProtectedConfigurationProvider/CS/ProtectedConfigurationProviderLib.cs Adds TripleDES deprecation warning and NIST-approved guidance.
snippets/csharp/VS_Snippets_CFX/windowsclientcredential/cs/source.cs Adds guidance not to hardcode credentials and to use a secure store.
snippets/csharp/VS_Snippets_CFX/samlattribute/cs/source.cs Updates SHA1 collision guidance to NIST-approved wording.
snippets/csharp/VS_Snippets_CFX/s_uex509certificatevalidationmode/cs/client.cs Adds guidance not to hardcode credentials and to use a secure store.
snippets/csharp/VS_Snippets_CFX/s_ueclientcredentials/cs/program.cs Adds guidance not to hardcode credentials and to use a secure store.
snippets/csharp/VS_Snippets_CFX/s_ue_httpdigestclientcredential/cs/source.cs Adds guidance not to hardcode credentials and to use a secure store.
snippets/csharp/System.Xml/XmlUrlResolver/Overview/XmlResolver_Samples.cs Adds guidance not to hardcode credentials and to use a secure store.
snippets/csharp/System.Xml/XmlResolver/Overview/Xslt_Load_v2.cs Adds guidance not to hardcode credentials and to use a secure store.
snippets/csharp/System.Xml/XmlParserContext/Overview/XmlReader_Create.cs Adds guidance not to hardcode credentials and to use a secure store.
snippets/csharp/System.Xml.Xsl/XslCompiledTransform/Overview/Xslt_Transform_v2.cs Adds guidance not to hardcode credentials and to use a secure store.
snippets/csharp/System.Windows.Forms/DataGridView/CellContentClick/employees.cs Adds SQL injection warning and recommends parameterized queries.
snippets/csharp/System.Security.Cryptography/Rfc2898DeriveBytes/Overview/rfc28981.cs Updates PBKDF2 iteration-count comment to reference NIST SP 800-132 guidance.
snippets/csharp/System.Security.Cryptography/RSACryptoServiceProvider/SignHash/class1.cs Updates SHA1 collision guidance to NIST-approved wording.
snippets/csharp/System.Security.Cryptography/PasswordDeriveBytes/Overview/sample.cs Updates SHA1 collision guidance to NIST-approved wording.
snippets/csharp/System.Security.Cryptography/DESCryptoServiceProvider/Overview/source.cs Adds DES insecurity warning and NIST-approved symmetric encryption guidance.
snippets/csharp/System.Security.Cryptography/DESCryptoServiceProvider/CreateEncryptor/memoryexample.cs Adds DES insecurity warning and NIST-approved symmetric encryption guidance.
snippets/csharp/System.Security.Cryptography/DESCryptoServiceProvider/CreateEncryptor/fileexample.cs Adds DES insecurity warning and NIST-approved symmetric encryption guidance.
snippets/csharp/System.Security.Cryptography/DES/Create/memoryexample.cs Adds DES insecurity warning and NIST-approved symmetric encryption guidance.
snippets/csharp/System.Security.Cryptography/DES/Create/fileexample.cs Adds DES insecurity warning and NIST-approved symmetric encryption guidance.
snippets/csharp/System.Security.Cryptography/CryptoConfig/Overview/members.cs Updates SHA1 collision guidance to NIST-approved wording.
snippets/csharp/System.Security.Cryptography/CryptoAPITransform/Overview/members.cs Adds DES insecurity warning and NIST-approved symmetric encryption guidance.
snippets/csharp/System.Security.Cryptography/AsymmetricAlgorithm/Overview/customcrypto.cs Updates SHA1 collision guidance to NIST-approved wording.
snippets/csharp/System.Net/ICertificatePolicy/Overview/source.cs Adds warning about obsolete API and certificate-validation bypass risks.
snippets/csharp/System.CodeDom/CodeChecksumPragma/Overview/codedirective.cs Updates SHA1/MD5 collision guidance to NIST-approved wording.

The digest method is the algorithm used to hash the <xref:System.Security.Cryptography.Xml.Reference>. The default algorithm is <xref:System.Security.Cryptography.SHA256>.
Due to collision problems with SHA-1, Microsoft recommends a security model based on SHA-256 or better. For more information about XML digital signatures, see the [W3C specification](https://www.w3.org/TR/xmldsig-core/).
Due to collision problems with SHA-1, Microsoft recommends using a NIST-approved hash function. For more information about XML digital signatures, see the [W3C specification](https://www.w3.org/TR/xmldsig-core/).
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

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

This updated guidance refers to a “NIST-approved hash function” but doesn’t include a link to NIST SP 800-131A Rev. 2. Adding the link would make the recommendation actionable and consistent with other crypto warnings in this PR.

Copilot uses AI. Check for mistakes.

The hash algorithm used on a fresh installation of Windows 7 when exporting via <xref:System.Security.Cryptography.X509Certificates.X509Certificate.Export*?displayProperty=nameWithtype> as a PKCS#12 PFX is <xref:System.Security.Cryptography.HashAlgorithmName.SHA1> with an iteration count of 2000.
Due to collision problems with SHA-1, Microsoft recommends a security model based on SHA-256 or better; however, some PFX readers might only support SHA-1.
Due to collision problems with SHA-1, Microsoft recommends using a NIST-approved hash function; however, some PFX readers might only support SHA-1.
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

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

This sentence switches to “NIST-approved hash function” but doesn’t provide the NIST SP 800-131A Rev. 2 link that the PR description calls out. Consider adding the link so readers can find the current approved set.

Copilot uses AI. Check for mistakes.
The hash size for the <xref:System.Security.Cryptography.SHA1Managed> algorithm is 160 bits.

Due to collision problems with SHA-1, Microsoft recommends a security model based on SHA-256 or better.
Due to collision problems with SHA-1, Microsoft recommends a security model based on a NIST-approved hash function. See [NIST SP 800-131A Rev. 2](https://csrc.nist.gov/pubs/sp/800/131/a/r2/final) for guidance on approved algorithms.
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

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

Within this file, the top-level remarks say “Microsoft recommends a security model based on a NIST-approved hash function”, but other updated remarks use “Microsoft recommends using a NIST-approved hash function”. Consider standardizing the phrasing (prefer the direct “recommends using …”) to improve readability and consistency.

Copilot uses AI. Check for mistakes.
For more information, see the [World Wide Web Consortium (W3C) specification](https://www.w3.org/2000/09/xmldsig#hmac-sha1).

Due to collision problems with SHA-1, Microsoft recommends a security model based on SHA-256 or better.
Due to collision problems with SHA-1, Microsoft recommends using a NIST-approved hash function.
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

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

This recommendation references a “NIST-approved hash function” but doesn’t link to the referenced NIST guidance. Consider adding the NIST SP 800-131A Rev. 2 link (as done in other updated crypto warnings) so readers can verify currently approved algorithms.

Copilot uses AI. Check for mistakes.
For more information, see the [World Wide Web Consortium (W3C) schema](https://www.w3.org/2000/09/xmldsig#sha1).

Due to collision problems with SHA-1, Microsoft recommends a security model based on SHA-256 or better.
Due to collision problems with SHA-1, Microsoft recommends using a NIST-approved hash function.
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

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

This recommendation references a “NIST-approved hash function” but doesn’t link to the NIST guidance. Consider adding the NIST SP 800-131A Rev. 2 link so the reader can find the current approved-algorithm list.

Copilot uses AI. Check for mistakes.

The hash algorithm used on a fresh installation of Windows 7 when exporting via <xref:System.Security.Cryptography.X509Certificates.X509Certificate.Export*?displayProperty=nameWithType> as a PKCS#12 PFX is <xref:System.Security.Cryptography.HashAlgorithmName.SHA1> with an iteration count of 2000.
Due to collision problems with SHA-1, Microsoft recommends a security model based on SHA-256 or better; however, some PFX readers might only support SHA-1.
Due to collision problems with SHA-1, Microsoft recommends using a NIST-approved hash function; however, some PFX readers might only support SHA-1.
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

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

Same as earlier in this file: consider adding the NIST SP 800-131A Rev. 2 link when recommending a “NIST-approved hash function”, to keep the guidance actionable and consistent.

Copilot uses AI. Check for mistakes.
Comment on lines +148 to +149
> [!IMPORTANT]
> RC4 is considered insecure and is no longer recommended for new applications. If the message queue infrastructure supports it, prefer using <xref:System.ServiceModel.MsmqEncryptionAlgorithm.Aes> instead.
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

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

The new RC4 warning recommends a specific replacement algorithm (Aes). This conflicts with the PR goal of avoiding specific algorithm recommendations and can become stale. Prefer wording like “use a NIST-approved symmetric encryption algorithm” and include the NIST SP 800-131A Rev. 2 link for guidance.

Copilot uses AI. Check for mistakes.
Comment on lines +119 to +120
> [!IMPORTANT]
> RC4 is considered insecure and is no longer recommended for new applications. If the message queue infrastructure supports it, prefer using <xref:System.ServiceModel.MsmqEncryptionAlgorithm.Aes> instead.
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

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

This warning recommends xref:System.ServiceModel.MsmqEncryptionAlgorithm.Aes, which reintroduces a specific algorithm recommendation. To align with the PR intent, replace it with guidance to use a NIST-approved symmetric encryption algorithm (with the NIST SP 800-131A Rev. 2 link).

Copilot uses AI. Check for mistakes.
For more information, see the [World Wide Web Consortium (W3C) schema](https://www.w3.org/2000/09/xmldsig#rsa-sha1).

Due to collision problems with SHA-1, Microsoft recommends a security model based on SHA-256 or better.
Due to collision problems with SHA-1, Microsoft recommends using a NIST-approved hash function.
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

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

This recommendation references a “NIST-approved hash function” but doesn’t link to the NIST guidance. Consider adding the NIST SP 800-131A Rev. 2 link for completeness and consistency with other warnings.

Copilot uses AI. Check for mistakes.

// This example uses the SHA1 and MD5 algorithms.
// Due to collision problems with SHA1 and MD5, Microsoft recommends SHA256 or better.
// Due to collision problems with SHA1 and MD5, Microsoft recommends using a NIST-approved hash function.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should this be:

Suggested change
// Due to collision problems with SHA1 and MD5, Microsoft recommends using a NIST-approved hash function.
// Due to collision problems with SHA1 and MD5, Microsoft recommends using an NIST-approved hash function.

// This sample demonstrates how to use each member of the CryptoAPITransform
// class.
// WARNING: DES has a 56-bit key and is considered insecure.
// For new applications, use a NIST-approved symmetric encryption algorithm instead.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
// For new applications, use a NIST-approved symmetric encryption algorithm instead.
// For new applications, use an NIST-approved symmetric encryption algorithm instead.

// WARNING: This example uses string concatenation for simplicity.
// In production code, always use parameterized queries to prevent
// SQL injection attacks.
DataGridView2.DataSource = Populate("SELECT * FROM Orders WHERE EmployeeId = " + employeeId);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If it's straightforward to use a parameterized query, I think we should do that, or I can do it in a follow up PR.

string UserName = "username";
// In production code, do not hardcode credentials in source code.
// Instead, retrieve them from a secure store such as Azure Key Vault.
string SecurelyStoredPassword = "psswd";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maybe we should rename the variable to something like insecurelyStoredPassword?

<MemberValue>192</MemberValue>
<Docs>
<summary>Specifies the Transport Layer Security (TLS) 1.0 security protocol. The TLS 1.0 protocol is defined in IETF RFC 2246.</summary>
<summary>Specifies the Transport Layer Security (TLS) 1.0 security protocol. The TLS 1.0 protocol is defined in IETF RFC 2246. TLS 1.0 has known vulnerabilities and is not recommended. Use <see cref="F:System.Net.SecurityProtocolType.Tls12" />, <see cref="F:System.Net.SecurityProtocolType.Tls13" />, or <see cref="F:System.Net.SecurityProtocolType.SystemDefault" /> instead.</summary>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is it okay to move this new text to the Remarks instead?

This constructor uses a 64-byte, randomly generated key.

Due to collision problems with MD5, Microsoft recommends SHA-256.
Due to collision problems with MD5, Microsoft recommends using a NIST-approved hash function. See [NIST SP 800-131A Rev. 2](https://csrc.nist.gov/pubs/sp/800/131/a/r2/final) for guidance on approved algorithms.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@copilot please change all occurrences of "See NIST SP 800-131A Rev. 2 for guidance on approved algorithms" to "For guidance on approved algorithms, see NIST SP 800-131A Rev. 2".

@@ -77,7 +77,7 @@
The <xref:System.Security.Cryptography.HashAlgorithm.ComputeHash*> methods of the <xref:System.Security.Cryptography.MD5> class return the hash as an array of 16 bytes. Note that some MD5 implementations produce a 32-character, hexadecimal-formatted hash. To interoperate with such implementations, format the return value of the <xref:System.Security.Cryptography.HashAlgorithm.ComputeHash*> methods as a hexadecimal value.

> [!NOTE]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
> [!NOTE]
> [!IMPORTANT]

> Never hard-code a password within your source code. Hard-coded passwords can be retrieved from an assembly by using the [Ildasm.exe (IL Disassembler)](/dotnet/framework/tools/ildasm-exe-il-disassembler), by using a hexadecimal editor, or by simply opening up the assembly in a text editor such as Notepad.exe.

> [!IMPORTANT]
> The default pseudo-random function (PRF) for this class is HMAC-SHA-1. Due to collision problems with SHA-1, Microsoft recommends using the constructor overloads that accept a <xref:System.Security.Cryptography.HashAlgorithmName> parameter, and passing a NIST-approved hash algorithm per [NIST SP 800-131A Rev. 2](https://csrc.nist.gov/pubs/sp/800/131/a/r2/final). [NIST SP 800-132](https://doi.org/10.6028/NIST.SP.800-132) recommends selecting the highest iteration count that is tolerable for your system, with a minimum of 600,000 iterations.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
> The default pseudo-random function (PRF) for this class is HMAC-SHA-1. Due to collision problems with SHA-1, Microsoft recommends using the constructor overloads that accept a <xref:System.Security.Cryptography.HashAlgorithmName> parameter, and passing a NIST-approved hash algorithm per [NIST SP 800-131A Rev. 2](https://csrc.nist.gov/pubs/sp/800/131/a/r2/final). [NIST SP 800-132](https://doi.org/10.6028/NIST.SP.800-132) recommends selecting the highest iteration count that is tolerable for your system, with a minimum of 600,000 iterations.
> The default pseudo-random function (PRF) for this class is HMAC-SHA-1. Due to collision problems with SHA-1, Microsoft recommends using the constructor overloads that accept a <xref:System.Security.Cryptography.HashAlgorithmName> parameter, and passing an NIST-approved hash algorithm per [NIST SP 800-131A Rev. 2](https://csrc.nist.gov/pubs/sp/800/131/a/r2/final). [NIST SP 800-132](https://doi.org/10.6028/NIST.SP.800-132) recommends selecting the highest iteration count that is tolerable for your system, with a minimum of 600,000 iterations.

> This type implements the <xref:System.IDisposable> interface. When you have finished using the type, you should dispose of it either directly or indirectly. To dispose of the type directly, call its <xref:System.IDisposable.Dispose*> method in a `try`/`catch` block. To dispose of it indirectly, use a language construct such as `using` (in C#) or `Using` (in Visual Basic). For more information, see the "Using an Object that Implements IDisposable" section in the <xref:System.IDisposable> interface topic.
Due to collision problems with SHA-1, Microsoft recommends a security model based on SHA-256 or better.
Due to collision problems with SHA-1, Microsoft recommends a security model based on a NIST-approved hash function. See [NIST SP 800-131A Rev. 2](https://csrc.nist.gov/pubs/sp/800/131/a/r2/final) for guidance on approved algorithms.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
Due to collision problems with SHA-1, Microsoft recommends a security model based on a NIST-approved hash function. See [NIST SP 800-131A Rev. 2](https://csrc.nist.gov/pubs/sp/800/131/a/r2/final) for guidance on approved algorithms.
Due to collision problems with SHA-1, Microsoft recommends a security model based on an NIST-approved hash function. See [NIST SP 800-131A Rev. 2](https://csrc.nist.gov/pubs/sp/800/131/a/r2/final) for guidance on approved algorithms.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not sure if it's generally pronounced "nist" or "n-i-s-t". If the latter, the article should be "an".

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'd say it's 99:1 "nist" over "N-I-S-T". So "NIST SP 800-131A" is "nist s-p eight hundred, one thirty one, a". ChatGPT's take on turning that into IPA is /nɪst ˌɛs ˈpiː ˌeɪt ˈhʌndrəd wʌn ˈθɜrti wʌn eɪ/, which looks sort of right? 😄

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 16, 2026

@gewarren I've opened a new pull request, #12526, to work on those changes. Once the pull request is ready, I'll request review from you.

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

Labels

area-Meta Concerns something that extends across runtime area boundaries, for example, IDisposable.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants