Skip to content

Obsolete Encrypt / Decrypt with fOAEP#124524

Merged
vcsjones merged 6 commits intodotnet:mainfrom
vcsjones:fix-113616
Mar 6, 2026
Merged

Obsolete Encrypt / Decrypt with fOAEP#124524
vcsjones merged 6 commits intodotnet:mainfrom
vcsjones:fix-113616

Conversation

@vcsjones
Copy link
Member

Closes #113616.

Copy link
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 pull request obsoletes the Encrypt and Decrypt methods on RSACryptoServiceProvider that accept a boolean parameter (fOAEP) for padding mode, as these methods implicitly use SHA-1 for OAEP padding which is now discouraged. Developers should use the overloads that accept RSAEncryptionPadding instead, which makes the hashing algorithm explicit.

Changes:

  • Added [Obsolete] attributes with diagnostic ID SYSLIB0064 to RSACryptoServiceProvider.Encrypt(byte[], bool) and RSACryptoServiceProvider.Decrypt(byte[], bool) methods
  • Refactored implementations to avoid mutual recursion: obsolete methods now delegate to the non-obsolete RSAEncryptionPadding overloads, while validation logic was moved from obsolete methods to the non-obsolete implementations
  • Added SYSLIB0064 diagnostic ID, message, and documentation entry

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSACryptoServiceProvider.Windows.cs Added obsolete attributes and refactored Windows implementation to move validation logic to non-obsolete methods
src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSACryptoServiceProvider.Unix.cs Added obsolete attributes and refactored Unix implementation to move validation logic to non-obsolete methods
src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSACryptoServiceProvider.NotSupported.cs Added obsolete attributes to stub implementations for unsupported platforms
src/libraries/System.Security.Cryptography/ref/System.Security.Cryptography.cs Updated reference assembly with obsolete attributes
src/libraries/Common/src/System/Obsoletions.cs Added SYSLIB0064 diagnostic ID and message constants
docs/project/list-of-diagnostics.md Added SYSLIB0064 to the diagnostic ID documentation table

@vcsjones vcsjones marked this pull request as ready for review February 17, 2026 22:18
Copilot AI review requested due to automatic review settings February 17, 2026 22:18
Copy link
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

Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.

@vcsjones vcsjones added the breaking-change Issue or PR that represents a breaking API or functional change over a previous release. label Mar 6, 2026
@vcsjones vcsjones enabled auto-merge (squash) March 6, 2026 18:50
@dotnet-policy-service dotnet-policy-service bot added the needs-breaking-change-doc-created Breaking changes need an issue opened with https://github.com/dotnet/docs/issues/new?template=dotnet label Mar 6, 2026
@dotnet-policy-service
Copy link
Contributor

dotnet-policy-service bot commented Mar 6, 2026

Added needs-breaking-change-doc-created label because this PR has the breaking-change label.

When you commit this breaking change:

  1. Create and link to this PR and the issue a matching issue in the dotnet/docs repo using the breaking change documentation template, then remove this needs-breaking-change-doc-created label.
  2. Ask a committer to mail the .NET Breaking Change Notification DL.

Tagging @dotnet/compat for awareness of the breaking change.

@vcsjones vcsjones merged commit 990d7a1 into dotnet:main Mar 6, 2026
92 of 96 checks passed
@github-actions
Copy link
Contributor

github-actions bot commented Mar 6, 2026

📋 Breaking Change Documentation Required

Create a breaking change issue with AI-generated content

Generated by Breaking Change Documentation Tool - 2026-03-06 19:13:04

@vcsjones vcsjones removed the needs-breaking-change-doc-created Breaking changes need an issue opened with https://github.com/dotnet/docs/issues/new?template=dotnet label Mar 6, 2026
@vcsjones vcsjones deleted the fix-113616 branch March 6, 2026 19:44
@vcsjones
Copy link
Member Author

vcsjones commented Mar 6, 2026

Breaking changes doc: dotnet/docs#52108

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

Labels

area-System.Security breaking-change Issue or PR that represents a breaking API or functional change over a previous release.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[API Proposal]: Obsolete RSACryptoServiceProvider.Decrypt,Encrypt with fOAEP

4 participants