Obsolete Encrypt / Decrypt with fOAEP#124524
Open
vcsjones wants to merge 3 commits intodotnet:mainfrom
Open
Conversation
Contributor
|
Tagging subscribers to this area: @bartonjs, @vcsjones, @dotnet/area-system-security |
Contributor
There was a problem hiding this comment.
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 toRSACryptoServiceProvider.Encrypt(byte[], bool)andRSACryptoServiceProvider.Decrypt(byte[], bool)methods - Refactored implementations to avoid mutual recursion: obsolete methods now delegate to the non-obsolete
RSAEncryptionPaddingoverloads, 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 |
bartonjs
reviewed
Feb 17, 2026
...stem.Security.Cryptography/src/System/Security/Cryptography/RSACryptoServiceProvider.Unix.cs
Show resolved
Hide resolved
This was referenced Feb 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #113616.