From ae7b109d1648dd64e4c80e7d50c6b0a92c30013b Mon Sep 17 00:00:00 2001 From: Annchous Date: Wed, 5 May 2021 14:48:33 +0300 Subject: [PATCH 01/28] add new obsoletion ID --- src/libraries/Common/src/System/Obsoletions.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libraries/Common/src/System/Obsoletions.cs b/src/libraries/Common/src/System/Obsoletions.cs index 7d5346ef79b6b..63decd8653da3 100644 --- a/src/libraries/Common/src/System/Obsoletions.cs +++ b/src/libraries/Common/src/System/Obsoletions.cs @@ -71,5 +71,8 @@ internal static class Obsoletions internal const string JsonSerializerOptionsIgnoreNullValuesMessage = "JsonSerializerOptions.IgnoreNullValues is obsolete. To ignore null values when serializing, set DefaultIgnoreCondition to JsonIgnoreCondition.WhenWritingNull."; internal const string JsonSerializerOptionsIgnoreNullValuesDiagId = "SYSLIB0020"; + + internal const string DerivedCryptographicTypesMessage = "Derived cryptographic types are obsolete."; + internal const string DerivedCryptographicTypesDiagId = "SYSLIB0021"; } } From 232775b25e0d84e4ae91291162520f048bc58808 Mon Sep 17 00:00:00 2001 From: Annchous Date: Wed, 5 May 2021 16:34:44 +0300 Subject: [PATCH 02/28] nowarn for new obsoletion --- src/libraries/Directory.Build.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/Directory.Build.targets b/src/libraries/Directory.Build.targets index 0da22fa69cc5f..8610e2e4811ed 100644 --- a/src/libraries/Directory.Build.targets +++ b/src/libraries/Directory.Build.targets @@ -18,7 +18,7 @@ $(NoWarn);nullable;CA1052 - $(NoWarn);SYSLIB0003;SYSLIB0004;SYSLIB0015;SYSLIB0017 + $(NoWarn);SYSLIB0003;SYSLIB0004;SYSLIB0015;SYSLIB0017;SYSLIB0021 From f7005f882e2348e19b500740abc73496eab620cd Mon Sep 17 00:00:00 2001 From: Annchous Date: Wed, 5 May 2021 16:35:55 +0300 Subject: [PATCH 03/28] add obsoletions to csproj --- .../src/System.Security.Cryptography.Csp.csproj | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libraries/System.Security.Cryptography.Csp/src/System.Security.Cryptography.Csp.csproj b/src/libraries/System.Security.Cryptography.Csp/src/System.Security.Cryptography.Csp.csproj index da68c42443e03..5efbcb99f2d16 100644 --- a/src/libraries/System.Security.Cryptography.Csp/src/System.Security.Cryptography.Csp.csproj +++ b/src/libraries/System.Security.Cryptography.Csp/src/System.Security.Cryptography.Csp.csproj @@ -131,4 +131,7 @@ + + + From bc94bc79398632413dad1c88f63d6db778eb7430 Mon Sep 17 00:00:00 2001 From: Annchous Date: Wed, 5 May 2021 16:36:56 +0300 Subject: [PATCH 04/28] AesCryptoServiceProvider obsoletion --- .../ref/System.Security.Cryptography.Csp.cs | 1 + .../src/System/Security/Cryptography/AesCryptoServiceProvider.cs | 1 + 2 files changed, 2 insertions(+) diff --git a/src/libraries/System.Security.Cryptography.Csp/ref/System.Security.Cryptography.Csp.cs b/src/libraries/System.Security.Cryptography.Csp/ref/System.Security.Cryptography.Csp.cs index a992ffcf0392f..e0da06df7310f 100644 --- a/src/libraries/System.Security.Cryptography.Csp/ref/System.Security.Cryptography.Csp.cs +++ b/src/libraries/System.Security.Cryptography.Csp/ref/System.Security.Cryptography.Csp.cs @@ -6,6 +6,7 @@ namespace System.Security.Cryptography { + [System.ObsoleteAttribute("Derived cryptographic types are obsolete.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public sealed partial class AesCryptoServiceProvider : System.Security.Cryptography.Aes { diff --git a/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/AesCryptoServiceProvider.cs b/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/AesCryptoServiceProvider.cs index a92f26e2ff575..c879a4f546087 100644 --- a/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/AesCryptoServiceProvider.cs +++ b/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/AesCryptoServiceProvider.cs @@ -5,6 +5,7 @@ namespace System.Security.Cryptography { + [Obsolete(Obsoletions.DerivedCryptographicTypesMessage, DiagnosticId = Obsoletions.DerivedCryptographicTypesDiagId, UrlFormat = Obsoletions.SharedUrlFormat)] [EditorBrowsable(EditorBrowsableState.Never)] public sealed class AesCryptoServiceProvider : Aes { From adddf44933d8ca481797e6255d94a4304b837094 Mon Sep 17 00:00:00 2001 From: Annchous Date: Wed, 5 May 2021 16:44:11 +0300 Subject: [PATCH 05/28] DESCryptoServiceProvider obsoletion --- .../ref/System.Security.Cryptography.Csp.cs | 1 + .../Security/Cryptography/DESCryptoServiceProvider.Unix.cs | 1 + .../Security/Cryptography/DESCryptoServiceProvider.Windows.cs | 1 + 3 files changed, 3 insertions(+) diff --git a/src/libraries/System.Security.Cryptography.Csp/ref/System.Security.Cryptography.Csp.cs b/src/libraries/System.Security.Cryptography.Csp/ref/System.Security.Cryptography.Csp.cs index e0da06df7310f..dd6b1c219b0f4 100644 --- a/src/libraries/System.Security.Cryptography.Csp/ref/System.Security.Cryptography.Csp.cs +++ b/src/libraries/System.Security.Cryptography.Csp/ref/System.Security.Cryptography.Csp.cs @@ -74,6 +74,7 @@ public enum CspProviderFlags NoPrompt = 64, CreateEphemeralKey = 128, } + [System.ObsoleteAttribute("Derived cryptographic types are obsolete.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public sealed partial class DESCryptoServiceProvider : System.Security.Cryptography.DES { diff --git a/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/DESCryptoServiceProvider.Unix.cs b/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/DESCryptoServiceProvider.Unix.cs index b01ec869d9665..34f2b13647a87 100644 --- a/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/DESCryptoServiceProvider.Unix.cs +++ b/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/DESCryptoServiceProvider.Unix.cs @@ -6,6 +6,7 @@ namespace System.Security.Cryptography { + [Obsolete(Obsoletions.DerivedCryptographicTypesMessage, DiagnosticId = Obsoletions.DerivedCryptographicTypesDiagId, UrlFormat = Obsoletions.SharedUrlFormat)] [EditorBrowsable(EditorBrowsableState.Never)] public sealed class DESCryptoServiceProvider : DES { diff --git a/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/DESCryptoServiceProvider.Windows.cs b/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/DESCryptoServiceProvider.Windows.cs index abfc5004ce863..d2536fd679169 100644 --- a/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/DESCryptoServiceProvider.Windows.cs +++ b/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/DESCryptoServiceProvider.Windows.cs @@ -7,6 +7,7 @@ namespace System.Security.Cryptography { + [Obsolete(Obsoletions.DerivedCryptographicTypesMessage, DiagnosticId = Obsoletions.DerivedCryptographicTypesDiagId, UrlFormat = Obsoletions.SharedUrlFormat)] [EditorBrowsable(EditorBrowsableState.Never)] public sealed class DESCryptoServiceProvider : DES { From 56775ea7d9e3f90d30d313eee2ad0b9532b77268 Mon Sep 17 00:00:00 2001 From: Annchous Date: Wed, 5 May 2021 16:45:48 +0300 Subject: [PATCH 06/28] MD5CryptoServiceProvider obsoletion --- .../ref/System.Security.Cryptography.Csp.cs | 1 + .../src/System/Security/Cryptography/MD5CryptoServiceProvider.cs | 1 + 2 files changed, 2 insertions(+) diff --git a/src/libraries/System.Security.Cryptography.Csp/ref/System.Security.Cryptography.Csp.cs b/src/libraries/System.Security.Cryptography.Csp/ref/System.Security.Cryptography.Csp.cs index dd6b1c219b0f4..fc32f94b275d1 100644 --- a/src/libraries/System.Security.Cryptography.Csp/ref/System.Security.Cryptography.Csp.cs +++ b/src/libraries/System.Security.Cryptography.Csp/ref/System.Security.Cryptography.Csp.cs @@ -130,6 +130,7 @@ public enum KeyNumber Exchange = 1, Signature = 2, } + [System.ObsoleteAttribute("Derived cryptographic types are obsolete.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public sealed partial class MD5CryptoServiceProvider : System.Security.Cryptography.MD5 { diff --git a/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/MD5CryptoServiceProvider.cs b/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/MD5CryptoServiceProvider.cs index 7fe188e479dee..03ac76255f023 100644 --- a/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/MD5CryptoServiceProvider.cs +++ b/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/MD5CryptoServiceProvider.cs @@ -5,6 +5,7 @@ namespace System.Security.Cryptography { + [Obsolete(Obsoletions.DerivedCryptographicTypesMessage, DiagnosticId = Obsoletions.DerivedCryptographicTypesDiagId, UrlFormat = Obsoletions.SharedUrlFormat)] [EditorBrowsable(EditorBrowsableState.Never)] public sealed class MD5CryptoServiceProvider : MD5 { From 4fdff538dcdeb326b0d57d37904b2bc553e126d1 Mon Sep 17 00:00:00 2001 From: Annchous Date: Wed, 5 May 2021 16:49:33 +0300 Subject: [PATCH 07/28] RC2CryptoServiceProvider obsoletion --- .../ref/System.Security.Cryptography.Csp.cs | 1 + .../Security/Cryptography/RC2CryptoServiceProvider.Windows.cs | 1 + 2 files changed, 2 insertions(+) diff --git a/src/libraries/System.Security.Cryptography.Csp/ref/System.Security.Cryptography.Csp.cs b/src/libraries/System.Security.Cryptography.Csp/ref/System.Security.Cryptography.Csp.cs index fc32f94b275d1..293e2a7d169cf 100644 --- a/src/libraries/System.Security.Cryptography.Csp/ref/System.Security.Cryptography.Csp.cs +++ b/src/libraries/System.Security.Cryptography.Csp/ref/System.Security.Cryptography.Csp.cs @@ -167,6 +167,7 @@ protected override void Dispose(bool disposing) { } public override byte[] GetBytes(int cb) { throw null; } public override void Reset() { } } + [System.ObsoleteAttribute("Derived cryptographic types are obsolete.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public sealed partial class RC2CryptoServiceProvider : System.Security.Cryptography.RC2 { diff --git a/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/RC2CryptoServiceProvider.Windows.cs b/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/RC2CryptoServiceProvider.Windows.cs index 97f01feb15a10..2255c53b1157c 100644 --- a/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/RC2CryptoServiceProvider.Windows.cs +++ b/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/RC2CryptoServiceProvider.Windows.cs @@ -8,6 +8,7 @@ namespace System.Security.Cryptography { + [Obsolete(Obsoletions.DerivedCryptographicTypesMessage, DiagnosticId = Obsoletions.DerivedCryptographicTypesDiagId, UrlFormat = Obsoletions.SharedUrlFormat)] [EditorBrowsable(EditorBrowsableState.Never)] public sealed class RC2CryptoServiceProvider : RC2 { From 89ecc58ae1413d5226ec45d68119a9f3e9f11f14 Mon Sep 17 00:00:00 2001 From: Annchous Date: Wed, 5 May 2021 16:51:27 +0300 Subject: [PATCH 08/28] SHA1CryptoServiceProvider obsoletion --- .../ref/System.Security.Cryptography.Csp.cs | 1 + .../System/Security/Cryptography/SHA1CryptoServiceProvider.cs | 1 + 2 files changed, 2 insertions(+) diff --git a/src/libraries/System.Security.Cryptography.Csp/ref/System.Security.Cryptography.Csp.cs b/src/libraries/System.Security.Cryptography.Csp/ref/System.Security.Cryptography.Csp.cs index 293e2a7d169cf..de2c5250d64d1 100644 --- a/src/libraries/System.Security.Cryptography.Csp/ref/System.Security.Cryptography.Csp.cs +++ b/src/libraries/System.Security.Cryptography.Csp/ref/System.Security.Cryptography.Csp.cs @@ -232,6 +232,7 @@ public override void ImportParameters(System.Security.Cryptography.RSAParameters public override bool VerifyHash(byte[] hash, byte[] signature, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.RSASignaturePadding padding) { throw null; } public bool VerifyHash(byte[] rgbHash, string str, byte[] rgbSignature) { throw null; } } + [System.ObsoleteAttribute("Derived cryptographic types are obsolete.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public sealed partial class SHA1CryptoServiceProvider : System.Security.Cryptography.SHA1 { diff --git a/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/SHA1CryptoServiceProvider.cs b/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/SHA1CryptoServiceProvider.cs index c98f3df61e530..75371fa9a0c8c 100644 --- a/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/SHA1CryptoServiceProvider.cs +++ b/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/SHA1CryptoServiceProvider.cs @@ -8,6 +8,7 @@ namespace System.Security.Cryptography // // If you change this file, make the corresponding changes to all of the SHA*CryptoServiceProvider.cs files. // + [Obsolete(Obsoletions.DerivedCryptographicTypesMessage, DiagnosticId = Obsoletions.DerivedCryptographicTypesDiagId, UrlFormat = Obsoletions.SharedUrlFormat)] [EditorBrowsable(EditorBrowsableState.Never)] public sealed class SHA1CryptoServiceProvider : SHA1 { From 76ce957adc1acc95966b1d5749c417f5121f2986 Mon Sep 17 00:00:00 2001 From: Annchous Date: Wed, 5 May 2021 16:52:37 +0300 Subject: [PATCH 09/28] SHA256CryptoServiceProvider obsoletion --- .../ref/System.Security.Cryptography.Csp.cs | 1 + .../System/Security/Cryptography/SHA256CryptoServiceProvider.cs | 1 + 2 files changed, 2 insertions(+) diff --git a/src/libraries/System.Security.Cryptography.Csp/ref/System.Security.Cryptography.Csp.cs b/src/libraries/System.Security.Cryptography.Csp/ref/System.Security.Cryptography.Csp.cs index de2c5250d64d1..708d2c0b1299e 100644 --- a/src/libraries/System.Security.Cryptography.Csp/ref/System.Security.Cryptography.Csp.cs +++ b/src/libraries/System.Security.Cryptography.Csp/ref/System.Security.Cryptography.Csp.cs @@ -244,6 +244,7 @@ protected override void HashCore(System.ReadOnlySpan source) { } public override void Initialize() { } protected override bool TryHashFinal(System.Span destination, out int bytesWritten) { throw null; } } + [System.ObsoleteAttribute("Derived cryptographic types are obsolete.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public sealed partial class SHA256CryptoServiceProvider : System.Security.Cryptography.SHA256 { diff --git a/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/SHA256CryptoServiceProvider.cs b/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/SHA256CryptoServiceProvider.cs index 452e8267affed..0d21bea5f330d 100644 --- a/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/SHA256CryptoServiceProvider.cs +++ b/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/SHA256CryptoServiceProvider.cs @@ -8,6 +8,7 @@ namespace System.Security.Cryptography // // If you change this file, make the corresponding changes to all of the SHA*CryptoServiceProvider.cs files. // + [Obsolete(Obsoletions.DerivedCryptographicTypesMessage, DiagnosticId = Obsoletions.DerivedCryptographicTypesDiagId, UrlFormat = Obsoletions.SharedUrlFormat)] [EditorBrowsable(EditorBrowsableState.Never)] public sealed class SHA256CryptoServiceProvider : SHA256 { From acf6002272ecd11470966018bfb8bd76420f2ba3 Mon Sep 17 00:00:00 2001 From: Annchous Date: Wed, 5 May 2021 16:53:42 +0300 Subject: [PATCH 10/28] SHA384CryptoServiceProvider obsoletion --- .../ref/System.Security.Cryptography.Csp.cs | 1 + .../System/Security/Cryptography/SHA384CryptoServiceProvider.cs | 1 + 2 files changed, 2 insertions(+) diff --git a/src/libraries/System.Security.Cryptography.Csp/ref/System.Security.Cryptography.Csp.cs b/src/libraries/System.Security.Cryptography.Csp/ref/System.Security.Cryptography.Csp.cs index 708d2c0b1299e..ecfd63d32a6f6 100644 --- a/src/libraries/System.Security.Cryptography.Csp/ref/System.Security.Cryptography.Csp.cs +++ b/src/libraries/System.Security.Cryptography.Csp/ref/System.Security.Cryptography.Csp.cs @@ -256,6 +256,7 @@ protected override void HashCore(System.ReadOnlySpan source) { } public override void Initialize() { } protected override bool TryHashFinal(System.Span destination, out int bytesWritten) { throw null; } } + [System.ObsoleteAttribute("Derived cryptographic types are obsolete.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public sealed partial class SHA384CryptoServiceProvider : System.Security.Cryptography.SHA384 { diff --git a/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/SHA384CryptoServiceProvider.cs b/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/SHA384CryptoServiceProvider.cs index 4a326a4099e2b..710aec29e5c27 100644 --- a/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/SHA384CryptoServiceProvider.cs +++ b/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/SHA384CryptoServiceProvider.cs @@ -8,6 +8,7 @@ namespace System.Security.Cryptography // // If you change this file, make the corresponding changes to all of the SHA*CryptoServiceProvider.cs files. // + [Obsolete(Obsoletions.DerivedCryptographicTypesMessage, DiagnosticId = Obsoletions.DerivedCryptographicTypesDiagId, UrlFormat = Obsoletions.SharedUrlFormat)] [EditorBrowsable(EditorBrowsableState.Never)] public sealed class SHA384CryptoServiceProvider : SHA384 { From 7724dc9a5b9e60f27e540ee17d840226ec47e2c7 Mon Sep 17 00:00:00 2001 From: Annchous Date: Wed, 5 May 2021 16:54:44 +0300 Subject: [PATCH 11/28] SHA512CryptoServiceProvider obsoletion --- .../ref/System.Security.Cryptography.Csp.cs | 1 + .../System/Security/Cryptography/SHA512CryptoServiceProvider.cs | 1 + 2 files changed, 2 insertions(+) diff --git a/src/libraries/System.Security.Cryptography.Csp/ref/System.Security.Cryptography.Csp.cs b/src/libraries/System.Security.Cryptography.Csp/ref/System.Security.Cryptography.Csp.cs index ecfd63d32a6f6..24bc3d8e8b8ca 100644 --- a/src/libraries/System.Security.Cryptography.Csp/ref/System.Security.Cryptography.Csp.cs +++ b/src/libraries/System.Security.Cryptography.Csp/ref/System.Security.Cryptography.Csp.cs @@ -268,6 +268,7 @@ protected override void HashCore(System.ReadOnlySpan source) { } public override void Initialize() { } protected override bool TryHashFinal(System.Span destination, out int bytesWritten) { throw null; } } + [System.ObsoleteAttribute("Derived cryptographic types are obsolete.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public sealed partial class SHA512CryptoServiceProvider : System.Security.Cryptography.SHA512 { diff --git a/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/SHA512CryptoServiceProvider.cs b/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/SHA512CryptoServiceProvider.cs index d45d22c9fef9c..cefbe75e72c25 100644 --- a/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/SHA512CryptoServiceProvider.cs +++ b/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/SHA512CryptoServiceProvider.cs @@ -8,6 +8,7 @@ namespace System.Security.Cryptography // // If you change this file, make the corresponding changes to all of the SHA*CryptoServiceProvider.cs files. // + [Obsolete(Obsoletions.DerivedCryptographicTypesMessage, DiagnosticId = Obsoletions.DerivedCryptographicTypesDiagId, UrlFormat = Obsoletions.SharedUrlFormat)] [EditorBrowsable(EditorBrowsableState.Never)] public sealed class SHA512CryptoServiceProvider : SHA512 { From 1294d03271fb9f90f4ff38bced95af76e675ca78 Mon Sep 17 00:00:00 2001 From: Annchous Date: Wed, 5 May 2021 16:55:32 +0300 Subject: [PATCH 12/28] TripleDESCryptoServiceProvider obsoletion --- .../ref/System.Security.Cryptography.Csp.cs | 1 + .../Security/Cryptography/TripleDESCryptoServiceProvider.cs | 1 + 2 files changed, 2 insertions(+) diff --git a/src/libraries/System.Security.Cryptography.Csp/ref/System.Security.Cryptography.Csp.cs b/src/libraries/System.Security.Cryptography.Csp/ref/System.Security.Cryptography.Csp.cs index 24bc3d8e8b8ca..ef1cac790cc31 100644 --- a/src/libraries/System.Security.Cryptography.Csp/ref/System.Security.Cryptography.Csp.cs +++ b/src/libraries/System.Security.Cryptography.Csp/ref/System.Security.Cryptography.Csp.cs @@ -280,6 +280,7 @@ protected override void HashCore(System.ReadOnlySpan source) { } public override void Initialize() { } protected override bool TryHashFinal(System.Span destination, out int bytesWritten) { throw null; } } + [System.ObsoleteAttribute("Derived cryptographic types are obsolete.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public sealed partial class TripleDESCryptoServiceProvider : System.Security.Cryptography.TripleDES { diff --git a/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/TripleDESCryptoServiceProvider.cs b/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/TripleDESCryptoServiceProvider.cs index 9bedeec0f9f09..6e40774f0f855 100644 --- a/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/TripleDESCryptoServiceProvider.cs +++ b/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/TripleDESCryptoServiceProvider.cs @@ -6,6 +6,7 @@ namespace System.Security.Cryptography { + [Obsolete(Obsoletions.DerivedCryptographicTypesMessage, DiagnosticId = Obsoletions.DerivedCryptographicTypesDiagId, UrlFormat = Obsoletions.SharedUrlFormat)] [EditorBrowsable(EditorBrowsableState.Never)] public sealed class TripleDESCryptoServiceProvider : TripleDES { From eef5db8f7cabc1ab1ed6a5b366be5e6903328dab Mon Sep 17 00:00:00 2001 From: Annchous Date: Wed, 5 May 2021 17:11:18 +0300 Subject: [PATCH 13/28] add obsoletions to csproj --- .../src/System.Security.Cryptography.Algorithms.csproj | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System.Security.Cryptography.Algorithms.csproj b/src/libraries/System.Security.Cryptography.Algorithms/src/System.Security.Cryptography.Algorithms.csproj index fc83d7af8faa9..01cb3f8f48f65 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/System.Security.Cryptography.Algorithms.csproj +++ b/src/libraries/System.Security.Cryptography.Algorithms/src/System.Security.Cryptography.Algorithms.csproj @@ -1,4 +1,4 @@ - + true $(DefineConstants);INTERNAL_ASYMMETRIC_IMPLEMENTATIONS @@ -16,6 +16,7 @@ + From 4fea03a6b8055ecdca9cb0b690307d7ed14df386 Mon Sep 17 00:00:00 2001 From: Annchous Date: Wed, 5 May 2021 17:11:52 +0300 Subject: [PATCH 14/28] *Managed obsoletions --- .../ref/System.Security.Cryptography.Algorithms.cs | 5 +++++ .../src/System/Security/Cryptography/AesManaged.cs | 1 + .../src/System/Security/Cryptography/SHA1Managed.cs | 1 + .../src/System/Security/Cryptography/SHA256Managed.cs | 1 + .../src/System/Security/Cryptography/SHA384Managed.cs | 1 + .../src/System/Security/Cryptography/SHA512Managed.cs | 1 + 6 files changed, 10 insertions(+) diff --git a/src/libraries/System.Security.Cryptography.Algorithms/ref/System.Security.Cryptography.Algorithms.cs b/src/libraries/System.Security.Cryptography.Algorithms/ref/System.Security.Cryptography.Algorithms.cs index 7423845019a78..eae5e3a2ff5d9 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/ref/System.Security.Cryptography.Algorithms.cs +++ b/src/libraries/System.Security.Cryptography.Algorithms/ref/System.Security.Cryptography.Algorithms.cs @@ -40,6 +40,7 @@ public void Dispose() { } public void Encrypt(byte[] nonce, byte[] plaintext, byte[] ciphertext, byte[] tag, byte[]? associatedData = null) { } public void Encrypt(System.ReadOnlySpan nonce, System.ReadOnlySpan plaintext, System.Span ciphertext, System.Span tag, System.ReadOnlySpan associatedData = default(System.ReadOnlySpan)) { } } + [System.ObsoleteAttribute("Derived cryptographic types are obsolete.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] public sealed partial class AesManaged : System.Security.Cryptography.Aes @@ -808,6 +809,7 @@ protected SHA1() { } public static int HashData(System.ReadOnlySpan source, System.Span destination) { throw null; } public static bool TryHashData(System.ReadOnlySpan source, System.Span destination, out int bytesWritten) { throw null; } } + [System.ObsoleteAttribute("Derived cryptographic types are obsolete.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public sealed partial class SHA1Managed : System.Security.Cryptography.SHA1 { @@ -830,6 +832,7 @@ protected SHA256() { } public static int HashData(System.ReadOnlySpan source, System.Span destination) { throw null; } public static bool TryHashData(System.ReadOnlySpan source, System.Span destination, out int bytesWritten) { throw null; } } + [System.ObsoleteAttribute("Derived cryptographic types are obsolete.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public sealed partial class SHA256Managed : System.Security.Cryptography.SHA256 { @@ -852,6 +855,7 @@ protected SHA384() { } public static int HashData(System.ReadOnlySpan source, System.Span destination) { throw null; } public static bool TryHashData(System.ReadOnlySpan source, System.Span destination, out int bytesWritten) { throw null; } } + [System.ObsoleteAttribute("Derived cryptographic types are obsolete.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public sealed partial class SHA384Managed : System.Security.Cryptography.SHA384 { @@ -874,6 +878,7 @@ protected SHA512() { } public static int HashData(System.ReadOnlySpan source, System.Span destination) { throw null; } public static bool TryHashData(System.ReadOnlySpan source, System.Span destination, out int bytesWritten) { throw null; } } + [System.ObsoleteAttribute("Derived cryptographic types are obsolete.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public sealed partial class SHA512Managed : System.Security.Cryptography.SHA512 { diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AesManaged.cs b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AesManaged.cs index 8501efa52a253..c49e5e571346c 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AesManaged.cs +++ b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AesManaged.cs @@ -6,6 +6,7 @@ namespace System.Security.Cryptography { + [Obsolete(Obsoletions.DerivedCryptographicTypesMessage, DiagnosticId = Obsoletions.DerivedCryptographicTypesDiagId, UrlFormat = Obsoletions.SharedUrlFormat)] [UnsupportedOSPlatform("browser")] [EditorBrowsable(EditorBrowsableState.Never)] public sealed class AesManaged : Aes diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/SHA1Managed.cs b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/SHA1Managed.cs index 66cff4dab2805..123b3591ee434 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/SHA1Managed.cs +++ b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/SHA1Managed.cs @@ -6,6 +6,7 @@ namespace System.Security.Cryptography { + [Obsolete(Obsoletions.DerivedCryptographicTypesMessage, DiagnosticId = Obsoletions.DerivedCryptographicTypesDiagId, UrlFormat = Obsoletions.SharedUrlFormat)] [EditorBrowsable(EditorBrowsableState.Never)] // SHA1Managed has a copy of the same implementation as SHA1 public sealed class SHA1Managed : SHA1 diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/SHA256Managed.cs b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/SHA256Managed.cs index 707a0475a0c7a..66b294f8fe15a 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/SHA256Managed.cs +++ b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/SHA256Managed.cs @@ -6,6 +6,7 @@ namespace System.Security.Cryptography { + [Obsolete(Obsoletions.DerivedCryptographicTypesMessage, DiagnosticId = Obsoletions.DerivedCryptographicTypesDiagId, UrlFormat = Obsoletions.SharedUrlFormat)] [EditorBrowsable(EditorBrowsableState.Never)] // SHA256Managed has a copy of the same implementation as SHA256 public sealed class SHA256Managed : SHA256 diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/SHA384Managed.cs b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/SHA384Managed.cs index f8c855dcc1138..d03bf45b288b6 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/SHA384Managed.cs +++ b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/SHA384Managed.cs @@ -6,6 +6,7 @@ namespace System.Security.Cryptography { + [Obsolete(Obsoletions.DerivedCryptographicTypesMessage, DiagnosticId = Obsoletions.DerivedCryptographicTypesDiagId, UrlFormat = Obsoletions.SharedUrlFormat)] [EditorBrowsable(EditorBrowsableState.Never)] // SHA384Managed has a copy of the same implementation as SHA384 public sealed class SHA384Managed : SHA384 diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/SHA512Managed.cs b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/SHA512Managed.cs index a4374b316e53d..1de1577d602f1 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/SHA512Managed.cs +++ b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/SHA512Managed.cs @@ -6,6 +6,7 @@ namespace System.Security.Cryptography { + [Obsolete(Obsoletions.DerivedCryptographicTypesMessage, DiagnosticId = Obsoletions.DerivedCryptographicTypesDiagId, UrlFormat = Obsoletions.SharedUrlFormat)] [EditorBrowsable(EditorBrowsableState.Never)] // SHA512Managed has a copy of the same implementation as SHA512 public sealed class SHA512Managed : SHA512 From 875a7ce52b8c3a885c88c7fd72a4ac5ce083a174 Mon Sep 17 00:00:00 2001 From: Annchous Date: Wed, 5 May 2021 19:07:29 +0300 Subject: [PATCH 15/28] add pragma suppress for types usages --- .../src/System/Security/Cryptography/CryptoConfig.cs | 2 ++ .../src/System/Security/Cryptography/PasswordDeriveBytes.cs | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/CryptoConfig.cs b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/CryptoConfig.cs index c7e60680cdf5d..d812a0ff0fff4 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/CryptoConfig.cs +++ b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/CryptoConfig.cs @@ -120,10 +120,12 @@ private static Dictionary DefaultNameHT Type HMACSHA384Type = typeof(System.Security.Cryptography.HMACSHA384); Type HMACSHA512Type = typeof(System.Security.Cryptography.HMACSHA512); Type RijndaelManagedType = typeof(System.Security.Cryptography.RijndaelManaged); +#pragma warning disable SYSLIB0021 // Obsolete: derived cryptographic types Type AesManagedType = typeof(System.Security.Cryptography.AesManaged); Type SHA256DefaultType = typeof(System.Security.Cryptography.SHA256Managed); Type SHA384DefaultType = typeof(System.Security.Cryptography.SHA384Managed); Type SHA512DefaultType = typeof(System.Security.Cryptography.SHA512Managed); +#pragma warning restore SYSLIB0021 string SHA1CryptoServiceProviderType = "System.Security.Cryptography.SHA1CryptoServiceProvider, " + AssemblyName_Csp; string MD5CryptoServiceProviderType = "System.Security.Cryptography.MD5CryptoServiceProvider," + AssemblyName_Csp; diff --git a/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/PasswordDeriveBytes.cs b/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/PasswordDeriveBytes.cs index 10e52dcf33fbe..82a4db632239f 100644 --- a/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/PasswordDeriveBytes.cs +++ b/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/PasswordDeriveBytes.cs @@ -41,6 +41,7 @@ public PasswordDeriveBytes(byte[] password, byte[]? salt, string hashName, int i this(password, salt, hashName, iterations, new CspParameters()) { } #pragma warning restore CA1416 +#pragma warning disable SYSLIB0021 // Obsolete: derived cryptographic types [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode", Justification = "The correct hash algorithm is being preserved by the DynamicDependency.")] [DynamicDependency(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor, typeof(SHA1CryptoServiceProvider))] public PasswordDeriveBytes(string strPassword, byte[]? rgbSalt, CspParameters? cspParams) : @@ -50,6 +51,7 @@ public PasswordDeriveBytes(string strPassword, byte[]? rgbSalt, CspParameters? c [DynamicDependency(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor, typeof(SHA1CryptoServiceProvider))] public PasswordDeriveBytes(byte[] password, byte[]? salt, CspParameters? cspParams) : this(password, salt, "SHA1", 100, cspParams) { } +#pragma warning restore SYSLIB0021 [RequiresUnreferencedCode(HashAlgorithmUnreferencedCodeMessage)] public PasswordDeriveBytes(string strPassword, byte[]? rgbSalt, string strHashName, int iterations, CspParameters? cspParams) : From 9bbaddd2639c0832b49fc4768f2aae8f8ea50fc7 Mon Sep 17 00:00:00 2001 From: Annchous Date: Wed, 5 May 2021 19:09:53 +0300 Subject: [PATCH 16/28] add nowarn in tests csproj --- .../tests/System.Security.Cryptography.Algorithms.Tests.csproj | 1 + .../tests/System.Security.Cryptography.Csp.Tests.csproj | 1 + 2 files changed, 2 insertions(+) diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/System.Security.Cryptography.Algorithms.Tests.csproj b/src/libraries/System.Security.Cryptography.Algorithms/tests/System.Security.Cryptography.Algorithms.Tests.csproj index 77ce3aa220dfc..483dc3c74a546 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/tests/System.Security.Cryptography.Algorithms.Tests.csproj +++ b/src/libraries/System.Security.Cryptography.Algorithms/tests/System.Security.Cryptography.Algorithms.Tests.csproj @@ -3,6 +3,7 @@ $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-Android;$(NetCoreAppCurrent)-Browser true true + $(NoWarn);SYSLIB0021 $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-Browser + $(NoWarn);SYSLIB0021 From f160484ed5655da6b372882e3642636b97a8e086 Mon Sep 17 00:00:00 2001 From: Annchous Date: Wed, 5 May 2021 19:10:24 +0300 Subject: [PATCH 17/28] add documentation --- docs/project/list-of-diagnostics.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/project/list-of-diagnostics.md b/docs/project/list-of-diagnostics.md index f12b4ef549192..576209caa2a52 100644 --- a/docs/project/list-of-diagnostics.md +++ b/docs/project/list-of-diagnostics.md @@ -70,6 +70,7 @@ The PR that reveals the implementation of the ` Date: Wed, 5 May 2021 19:59:03 +0300 Subject: [PATCH 18/28] add nowarn to new identified tests csproj --- .../tests/System.Runtime.Serialization.Xml.Tests.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libraries/System.Runtime.Serialization.Xml/tests/System.Runtime.Serialization.Xml.Tests.csproj b/src/libraries/System.Runtime.Serialization.Xml/tests/System.Runtime.Serialization.Xml.Tests.csproj index b7878a3720449..4a90ad779e7b4 100644 --- a/src/libraries/System.Runtime.Serialization.Xml/tests/System.Runtime.Serialization.Xml.Tests.csproj +++ b/src/libraries/System.Runtime.Serialization.Xml/tests/System.Runtime.Serialization.Xml.Tests.csproj @@ -1,6 +1,7 @@ $(NetCoreAppCurrent) + $(NoWarn);SYSLIB0021 From 06f3e78549c8496b4493fd4522a1028c67db7972 Mon Sep 17 00:00:00 2001 From: Annchous Date: Wed, 5 May 2021 20:01:29 +0300 Subject: [PATCH 19/28] add pragma suppress for types usages #2 --- .../src/System/Security/Cryptography/CryptoConfig.Browser.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/CryptoConfig.Browser.cs b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/CryptoConfig.Browser.cs index 396710c6ae9f7..f57fceeba68f9 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/CryptoConfig.Browser.cs +++ b/src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/CryptoConfig.Browser.cs @@ -33,6 +33,7 @@ public partial class CryptoConfig switch (name) { +#pragma warning disable SYSLIB0021 // Obsolete: derived cryptographic types // hardcode mapping for SHA* algorithm names from https://docs.microsoft.com/en-us/dotnet/api/system.security.cryptography.cryptoconfig?view=net-5.0#remarks case "SHA": case "SHA1": @@ -50,6 +51,7 @@ public partial class CryptoConfig case "SHA-512": case "System.Security.Cryptography.SHA512": return new SHA512Managed(); +#pragma warning restore SYSLIB0021 } return null; From 7afc9d51aafbbd49dcb07b34028d6ef6a5d21e84 Mon Sep 17 00:00:00 2001 From: Annchous Date: Thu, 6 May 2021 13:25:37 +0300 Subject: [PATCH 20/28] update documentation --- docs/project/list-of-diagnostics.md | 2 +- src/libraries/Common/src/System/Obsoletions.cs | 2 +- src/libraries/Directory.Build.targets | 6 +++++- .../System.Security.Cryptography.Algorithms.cs | 10 +++++----- ...curity.Cryptography.Algorithms.Tests.csproj | 1 + .../ref/System.Security.Cryptography.Csp.cs | 18 +++++++++--------- ...stem.Security.Cryptography.Csp.Tests.csproj | 1 + 7 files changed, 23 insertions(+), 17 deletions(-) diff --git a/docs/project/list-of-diagnostics.md b/docs/project/list-of-diagnostics.md index 576209caa2a52..6160c370957a3 100644 --- a/docs/project/list-of-diagnostics.md +++ b/docs/project/list-of-diagnostics.md @@ -70,7 +70,7 @@ The PR that reveals the implementation of the `$(NoWarn);nullable $(NoWarn);nullable;CA1052 + SYSLIB0003: Code Access Security (CAS). + SYSLIB0004: Constrained Execution Region (CER). + SYSLIB0017: Strong name signing. + SYSLIB0021: Derived cryptographic types. + --> $(NoWarn);SYSLIB0003;SYSLIB0004;SYSLIB0015;SYSLIB0017;SYSLIB0021 diff --git a/src/libraries/System.Security.Cryptography.Algorithms/ref/System.Security.Cryptography.Algorithms.cs b/src/libraries/System.Security.Cryptography.Algorithms/ref/System.Security.Cryptography.Algorithms.cs index eae5e3a2ff5d9..2d0a5658e9d9b 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/ref/System.Security.Cryptography.Algorithms.cs +++ b/src/libraries/System.Security.Cryptography.Algorithms/ref/System.Security.Cryptography.Algorithms.cs @@ -40,7 +40,7 @@ public void Dispose() { } public void Encrypt(byte[] nonce, byte[] plaintext, byte[] ciphertext, byte[] tag, byte[]? associatedData = null) { } public void Encrypt(System.ReadOnlySpan nonce, System.ReadOnlySpan plaintext, System.Span ciphertext, System.Span tag, System.ReadOnlySpan associatedData = default(System.ReadOnlySpan)) { } } - [System.ObsoleteAttribute("Derived cryptographic types are obsolete.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] + [System.ObsoleteAttribute("Derived cryptographic types are obsolete. Use the Create method on the underlying type instead.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] public sealed partial class AesManaged : System.Security.Cryptography.Aes @@ -809,7 +809,7 @@ protected SHA1() { } public static int HashData(System.ReadOnlySpan source, System.Span destination) { throw null; } public static bool TryHashData(System.ReadOnlySpan source, System.Span destination, out int bytesWritten) { throw null; } } - [System.ObsoleteAttribute("Derived cryptographic types are obsolete.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] + [System.ObsoleteAttribute("Derived cryptographic types are obsolete. Use the Create method on the underlying type instead.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public sealed partial class SHA1Managed : System.Security.Cryptography.SHA1 { @@ -832,7 +832,7 @@ protected SHA256() { } public static int HashData(System.ReadOnlySpan source, System.Span destination) { throw null; } public static bool TryHashData(System.ReadOnlySpan source, System.Span destination, out int bytesWritten) { throw null; } } - [System.ObsoleteAttribute("Derived cryptographic types are obsolete.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] + [System.ObsoleteAttribute("Derived cryptographic types are obsolete. Use the Create method on the underlying type instead.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public sealed partial class SHA256Managed : System.Security.Cryptography.SHA256 { @@ -855,7 +855,7 @@ protected SHA384() { } public static int HashData(System.ReadOnlySpan source, System.Span destination) { throw null; } public static bool TryHashData(System.ReadOnlySpan source, System.Span destination, out int bytesWritten) { throw null; } } - [System.ObsoleteAttribute("Derived cryptographic types are obsolete.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] + [System.ObsoleteAttribute("Derived cryptographic types are obsolete. Use the Create method on the underlying type instead.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public sealed partial class SHA384Managed : System.Security.Cryptography.SHA384 { @@ -878,7 +878,7 @@ protected SHA512() { } public static int HashData(System.ReadOnlySpan source, System.Span destination) { throw null; } public static bool TryHashData(System.ReadOnlySpan source, System.Span destination, out int bytesWritten) { throw null; } } - [System.ObsoleteAttribute("Derived cryptographic types are obsolete.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] + [System.ObsoleteAttribute("Derived cryptographic types are obsolete. Use the Create method on the underlying type instead.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public sealed partial class SHA512Managed : System.Security.Cryptography.SHA512 { diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/System.Security.Cryptography.Algorithms.Tests.csproj b/src/libraries/System.Security.Cryptography.Algorithms/tests/System.Security.Cryptography.Algorithms.Tests.csproj index 483dc3c74a546..3599747bd2f7f 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/tests/System.Security.Cryptography.Algorithms.Tests.csproj +++ b/src/libraries/System.Security.Cryptography.Algorithms/tests/System.Security.Cryptography.Algorithms.Tests.csproj @@ -3,6 +3,7 @@ $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-Android;$(NetCoreAppCurrent)-Browser true true + $(NoWarn);SYSLIB0021 diff --git a/src/libraries/System.Security.Cryptography.Csp/ref/System.Security.Cryptography.Csp.cs b/src/libraries/System.Security.Cryptography.Csp/ref/System.Security.Cryptography.Csp.cs index ef1cac790cc31..9d2db58ebd8f1 100644 --- a/src/libraries/System.Security.Cryptography.Csp/ref/System.Security.Cryptography.Csp.cs +++ b/src/libraries/System.Security.Cryptography.Csp/ref/System.Security.Cryptography.Csp.cs @@ -6,7 +6,7 @@ namespace System.Security.Cryptography { - [System.ObsoleteAttribute("Derived cryptographic types are obsolete.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] + [System.ObsoleteAttribute("Derived cryptographic types are obsolete. Use the Create method on the underlying type instead.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public sealed partial class AesCryptoServiceProvider : System.Security.Cryptography.Aes { @@ -74,7 +74,7 @@ public enum CspProviderFlags NoPrompt = 64, CreateEphemeralKey = 128, } - [System.ObsoleteAttribute("Derived cryptographic types are obsolete.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] + [System.ObsoleteAttribute("Derived cryptographic types are obsolete. Use the Create method on the underlying type instead.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public sealed partial class DESCryptoServiceProvider : System.Security.Cryptography.DES { @@ -130,7 +130,7 @@ public enum KeyNumber Exchange = 1, Signature = 2, } - [System.ObsoleteAttribute("Derived cryptographic types are obsolete.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] + [System.ObsoleteAttribute("Derived cryptographic types are obsolete. Use the Create method on the underlying type instead.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public sealed partial class MD5CryptoServiceProvider : System.Security.Cryptography.MD5 { @@ -167,7 +167,7 @@ protected override void Dispose(bool disposing) { } public override byte[] GetBytes(int cb) { throw null; } public override void Reset() { } } - [System.ObsoleteAttribute("Derived cryptographic types are obsolete.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] + [System.ObsoleteAttribute("Derived cryptographic types are obsolete. Use the Create method on the underlying type instead.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public sealed partial class RC2CryptoServiceProvider : System.Security.Cryptography.RC2 { @@ -232,7 +232,7 @@ public override void ImportParameters(System.Security.Cryptography.RSAParameters public override bool VerifyHash(byte[] hash, byte[] signature, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.RSASignaturePadding padding) { throw null; } public bool VerifyHash(byte[] rgbHash, string str, byte[] rgbSignature) { throw null; } } - [System.ObsoleteAttribute("Derived cryptographic types are obsolete.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] + [System.ObsoleteAttribute("Derived cryptographic types are obsolete. Use the Create method on the underlying type instead.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public sealed partial class SHA1CryptoServiceProvider : System.Security.Cryptography.SHA1 { @@ -244,7 +244,7 @@ protected override void HashCore(System.ReadOnlySpan source) { } public override void Initialize() { } protected override bool TryHashFinal(System.Span destination, out int bytesWritten) { throw null; } } - [System.ObsoleteAttribute("Derived cryptographic types are obsolete.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] + [System.ObsoleteAttribute("Derived cryptographic types are obsolete. Use the Create method on the underlying type instead.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public sealed partial class SHA256CryptoServiceProvider : System.Security.Cryptography.SHA256 { @@ -256,7 +256,7 @@ protected override void HashCore(System.ReadOnlySpan source) { } public override void Initialize() { } protected override bool TryHashFinal(System.Span destination, out int bytesWritten) { throw null; } } - [System.ObsoleteAttribute("Derived cryptographic types are obsolete.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] + [System.ObsoleteAttribute("Derived cryptographic types are obsolete. Use the Create method on the underlying type instead.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public sealed partial class SHA384CryptoServiceProvider : System.Security.Cryptography.SHA384 { @@ -268,7 +268,7 @@ protected override void HashCore(System.ReadOnlySpan source) { } public override void Initialize() { } protected override bool TryHashFinal(System.Span destination, out int bytesWritten) { throw null; } } - [System.ObsoleteAttribute("Derived cryptographic types are obsolete.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] + [System.ObsoleteAttribute("Derived cryptographic types are obsolete. Use the Create method on the underlying type instead.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public sealed partial class SHA512CryptoServiceProvider : System.Security.Cryptography.SHA512 { @@ -280,7 +280,7 @@ protected override void HashCore(System.ReadOnlySpan source) { } public override void Initialize() { } protected override bool TryHashFinal(System.Span destination, out int bytesWritten) { throw null; } } - [System.ObsoleteAttribute("Derived cryptographic types are obsolete.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] + [System.ObsoleteAttribute("Derived cryptographic types are obsolete. Use the Create method on the underlying type instead.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public sealed partial class TripleDESCryptoServiceProvider : System.Security.Cryptography.TripleDES { diff --git a/src/libraries/System.Security.Cryptography.Csp/tests/System.Security.Cryptography.Csp.Tests.csproj b/src/libraries/System.Security.Cryptography.Csp/tests/System.Security.Cryptography.Csp.Tests.csproj index b17591be4c281..2343260ca112b 100644 --- a/src/libraries/System.Security.Cryptography.Csp/tests/System.Security.Cryptography.Csp.Tests.csproj +++ b/src/libraries/System.Security.Cryptography.Csp/tests/System.Security.Cryptography.Csp.Tests.csproj @@ -1,6 +1,7 @@ $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-Browser + $(NoWarn);SYSLIB0021 From 665f37d276b0eda3f7fdaa2501cf27ca878182c0 Mon Sep 17 00:00:00 2001 From: Annchous Date: Thu, 6 May 2021 19:52:22 +0300 Subject: [PATCH 21/28] fix md5 usage --- .../tests/SerializationTestTypes/DataContract.cs | 4 ++-- .../tests/System.Runtime.Serialization.Xml.Tests.csproj | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/libraries/System.Runtime.Serialization.Xml/tests/SerializationTestTypes/DataContract.cs b/src/libraries/System.Runtime.Serialization.Xml/tests/SerializationTestTypes/DataContract.cs index 955edb1dc46ad..1d3314ca1a25a 100644 --- a/src/libraries/System.Runtime.Serialization.Xml/tests/SerializationTestTypes/DataContract.cs +++ b/src/libraries/System.Runtime.Serialization.Xml/tests/SerializationTestTypes/DataContract.cs @@ -208,7 +208,7 @@ public int GetHashCode(RuntimeTypeHandle obj) public class DataContract { static Dictionary cache = new Dictionary(RuntimeTypeHandleEqualityComparer.Comparer); - static MD5CryptoServiceProvider md5 = null; + static MD5 md5 = null; Type underlyingType; bool isValueType; @@ -267,7 +267,7 @@ internal static string ExpandGenericParameters(string format, IGenericNameProvid private static string GetNamespacesDigest(string namespaces) { if (md5 == null) - md5 = new MD5CryptoServiceProvider(); + md5 = MD5.Create(); byte[] namespaceBytes = Encoding.UTF8.GetBytes(namespaces); byte[] digestBytes = md5.ComputeHash(namespaceBytes); char[] digestChars = new char[24]; diff --git a/src/libraries/System.Runtime.Serialization.Xml/tests/System.Runtime.Serialization.Xml.Tests.csproj b/src/libraries/System.Runtime.Serialization.Xml/tests/System.Runtime.Serialization.Xml.Tests.csproj index 4a90ad779e7b4..b7878a3720449 100644 --- a/src/libraries/System.Runtime.Serialization.Xml/tests/System.Runtime.Serialization.Xml.Tests.csproj +++ b/src/libraries/System.Runtime.Serialization.Xml/tests/System.Runtime.Serialization.Xml.Tests.csproj @@ -1,7 +1,6 @@ $(NetCoreAppCurrent) - $(NoWarn);SYSLIB0021 From 403413a3349f07890abde6a0d1a7577c12edfb77 Mon Sep 17 00:00:00 2001 From: Jeff Handley Date: Thu, 6 May 2021 10:44:26 -0700 Subject: [PATCH 22/28] Fix indentation --- src/libraries/Directory.Build.targets | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/libraries/Directory.Build.targets b/src/libraries/Directory.Build.targets index 100f38c873a62..83a3fbbe7a53f 100644 --- a/src/libraries/Directory.Build.targets +++ b/src/libraries/Directory.Build.targets @@ -17,11 +17,11 @@ $(NoWarn);nullable $(NoWarn);nullable;CA1052 $(NoWarn);SYSLIB0003;SYSLIB0004;SYSLIB0015;SYSLIB0017;SYSLIB0021;SYSLIB0022 From 4e5bef6f0aa61de5737741de2c053c810f82e2b4 Mon Sep 17 00:00:00 2001 From: Annchous Date: Thu, 6 May 2021 21:10:19 +0300 Subject: [PATCH 23/28] fix obsoletions inclusion in csproj --- .../src/System.Security.Cryptography.Csp.csproj | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/libraries/System.Security.Cryptography.Csp/src/System.Security.Cryptography.Csp.csproj b/src/libraries/System.Security.Cryptography.Csp/src/System.Security.Cryptography.Csp.csproj index 5efbcb99f2d16..e3a6b86dc4be4 100644 --- a/src/libraries/System.Security.Cryptography.Csp/src/System.Security.Cryptography.Csp.csproj +++ b/src/libraries/System.Security.Cryptography.Csp/src/System.Security.Cryptography.Csp.csproj @@ -31,6 +31,8 @@ Link="Common\System\Security\Cryptography\KeySizeHelpers.cs" /> + @@ -131,7 +133,4 @@ - - - From f8067e9cadbfa6a76f5e388e53383a4b2be60802 Mon Sep 17 00:00:00 2001 From: Annchous Date: Thu, 6 May 2021 21:34:13 +0300 Subject: [PATCH 24/28] remove extra obsoletions inclusion in csproj --- .../src/System.Security.Cryptography.Algorithms.csproj | 1 - 1 file changed, 1 deletion(-) diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System.Security.Cryptography.Algorithms.csproj b/src/libraries/System.Security.Cryptography.Algorithms/src/System.Security.Cryptography.Algorithms.csproj index 4a3f507185f7d..5227b2935cb4a 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/System.Security.Cryptography.Algorithms.csproj +++ b/src/libraries/System.Security.Cryptography.Algorithms/src/System.Security.Cryptography.Algorithms.csproj @@ -16,7 +16,6 @@ - From 4b0f491b0ec863f6e038e3ad62672c071cb0bac4 Mon Sep 17 00:00:00 2001 From: Jeff Handley Date: Thu, 6 May 2021 12:42:53 -0700 Subject: [PATCH 25/28] De-dupe project items that were in both the browser and non-browser configs. Ensure Obsoletions.cs is included in all configs. --- ...em.Security.Cryptography.Algorithms.csproj | 50 +++++++------------ 1 file changed, 18 insertions(+), 32 deletions(-) diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System.Security.Cryptography.Algorithms.csproj b/src/libraries/System.Security.Cryptography.Algorithms/src/System.Security.Cryptography.Algorithms.csproj index 5227b2935cb4a..24b136c20cda1 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/System.Security.Cryptography.Algorithms.csproj +++ b/src/libraries/System.Security.Cryptography.Algorithms/src/System.Security.Cryptography.Algorithms.csproj @@ -1,4 +1,4 @@ - + true $(DefineConstants);INTERNAL_ASYMMETRIC_IMPLEMENTATIONS @@ -16,14 +16,28 @@ + + + + + + + + + + + + + + + - - - @@ -61,22 +75,12 @@ - - - - - - - - - - @@ -104,8 +108,6 @@ Link="Internal\Cryptography\BasicSymmetricCipher.cs" /> - - - - - @@ -706,16 +702,6 @@ - - - - - - - - - - From 5a97ee09f85ef6607d21ee606cd83cf82e001964 Mon Sep 17 00:00:00 2001 From: Jeff Handley Date: Thu, 6 May 2021 14:06:07 -0700 Subject: [PATCH 26/28] Remove duplicate RandomNumberGeneratorImplementation.cs reference --- .../src/System.Security.Cryptography.Algorithms.csproj | 1 - 1 file changed, 1 deletion(-) diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System.Security.Cryptography.Algorithms.csproj b/src/libraries/System.Security.Cryptography.Algorithms/src/System.Security.Cryptography.Algorithms.csproj index 24b136c20cda1..6dbe4fe97575a 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/System.Security.Cryptography.Algorithms.csproj +++ b/src/libraries/System.Security.Cryptography.Algorithms/src/System.Security.Cryptography.Algorithms.csproj @@ -695,7 +695,6 @@ - From f13b2b730b8c17b92bb30c1be57ad1fbe172b822 Mon Sep 17 00:00:00 2001 From: Annchous Date: Fri, 7 May 2021 01:24:26 +0300 Subject: [PATCH 27/28] Update documentation --- docs/project/list-of-diagnostics.md | 2 +- src/libraries/Common/src/System/Obsoletions.cs | 2 +- .../System.Security.Cryptography.Algorithms.cs | 10 +++++----- .../ref/System.Security.Cryptography.Csp.cs | 18 +++++++++--------- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/docs/project/list-of-diagnostics.md b/docs/project/list-of-diagnostics.md index ca01d438aafb3..e7734f8633e78 100644 --- a/docs/project/list-of-diagnostics.md +++ b/docs/project/list-of-diagnostics.md @@ -75,7 +75,7 @@ The PR that reveals the implementation of the ` nonce, System.ReadOnlySpan plaintext, System.Span ciphertext, System.Span tag, System.ReadOnlySpan associatedData = default(System.ReadOnlySpan)) { } } - [System.ObsoleteAttribute("Derived cryptographic types are obsolete. Use the Create method on the underlying type instead.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] + [System.ObsoleteAttribute("Derived cryptographic types are obsolete. Use the Create method on the base type instead.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] public sealed partial class AesManaged : System.Security.Cryptography.Aes @@ -825,7 +825,7 @@ protected SHA1() { } public static int HashData(System.ReadOnlySpan source, System.Span destination) { throw null; } public static bool TryHashData(System.ReadOnlySpan source, System.Span destination, out int bytesWritten) { throw null; } } - [System.ObsoleteAttribute("Derived cryptographic types are obsolete. Use the Create method on the underlying type instead.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] + [System.ObsoleteAttribute("Derived cryptographic types are obsolete. Use the Create method on the base type instead.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public sealed partial class SHA1Managed : System.Security.Cryptography.SHA1 { @@ -848,7 +848,7 @@ protected SHA256() { } public static int HashData(System.ReadOnlySpan source, System.Span destination) { throw null; } public static bool TryHashData(System.ReadOnlySpan source, System.Span destination, out int bytesWritten) { throw null; } } - [System.ObsoleteAttribute("Derived cryptographic types are obsolete. Use the Create method on the underlying type instead.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] + [System.ObsoleteAttribute("Derived cryptographic types are obsolete. Use the Create method on the base type instead.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public sealed partial class SHA256Managed : System.Security.Cryptography.SHA256 { @@ -871,7 +871,7 @@ protected SHA384() { } public static int HashData(System.ReadOnlySpan source, System.Span destination) { throw null; } public static bool TryHashData(System.ReadOnlySpan source, System.Span destination, out int bytesWritten) { throw null; } } - [System.ObsoleteAttribute("Derived cryptographic types are obsolete. Use the Create method on the underlying type instead.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] + [System.ObsoleteAttribute("Derived cryptographic types are obsolete. Use the Create method on the base type instead.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public sealed partial class SHA384Managed : System.Security.Cryptography.SHA384 { @@ -894,7 +894,7 @@ protected SHA512() { } public static int HashData(System.ReadOnlySpan source, System.Span destination) { throw null; } public static bool TryHashData(System.ReadOnlySpan source, System.Span destination, out int bytesWritten) { throw null; } } - [System.ObsoleteAttribute("Derived cryptographic types are obsolete. Use the Create method on the underlying type instead.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] + [System.ObsoleteAttribute("Derived cryptographic types are obsolete. Use the Create method on the base type instead.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public sealed partial class SHA512Managed : System.Security.Cryptography.SHA512 { diff --git a/src/libraries/System.Security.Cryptography.Csp/ref/System.Security.Cryptography.Csp.cs b/src/libraries/System.Security.Cryptography.Csp/ref/System.Security.Cryptography.Csp.cs index 9d2db58ebd8f1..913c9b4c3286f 100644 --- a/src/libraries/System.Security.Cryptography.Csp/ref/System.Security.Cryptography.Csp.cs +++ b/src/libraries/System.Security.Cryptography.Csp/ref/System.Security.Cryptography.Csp.cs @@ -6,7 +6,7 @@ namespace System.Security.Cryptography { - [System.ObsoleteAttribute("Derived cryptographic types are obsolete. Use the Create method on the underlying type instead.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] + [System.ObsoleteAttribute("Derived cryptographic types are obsolete. Use the Create method on the base type instead.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public sealed partial class AesCryptoServiceProvider : System.Security.Cryptography.Aes { @@ -74,7 +74,7 @@ public enum CspProviderFlags NoPrompt = 64, CreateEphemeralKey = 128, } - [System.ObsoleteAttribute("Derived cryptographic types are obsolete. Use the Create method on the underlying type instead.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] + [System.ObsoleteAttribute("Derived cryptographic types are obsolete. Use the Create method on the base type instead.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public sealed partial class DESCryptoServiceProvider : System.Security.Cryptography.DES { @@ -130,7 +130,7 @@ public enum KeyNumber Exchange = 1, Signature = 2, } - [System.ObsoleteAttribute("Derived cryptographic types are obsolete. Use the Create method on the underlying type instead.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] + [System.ObsoleteAttribute("Derived cryptographic types are obsolete. Use the Create method on the base type instead.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public sealed partial class MD5CryptoServiceProvider : System.Security.Cryptography.MD5 { @@ -167,7 +167,7 @@ protected override void Dispose(bool disposing) { } public override byte[] GetBytes(int cb) { throw null; } public override void Reset() { } } - [System.ObsoleteAttribute("Derived cryptographic types are obsolete. Use the Create method on the underlying type instead.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] + [System.ObsoleteAttribute("Derived cryptographic types are obsolete. Use the Create method on the base type instead.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public sealed partial class RC2CryptoServiceProvider : System.Security.Cryptography.RC2 { @@ -232,7 +232,7 @@ public override void ImportParameters(System.Security.Cryptography.RSAParameters public override bool VerifyHash(byte[] hash, byte[] signature, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.RSASignaturePadding padding) { throw null; } public bool VerifyHash(byte[] rgbHash, string str, byte[] rgbSignature) { throw null; } } - [System.ObsoleteAttribute("Derived cryptographic types are obsolete. Use the Create method on the underlying type instead.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] + [System.ObsoleteAttribute("Derived cryptographic types are obsolete. Use the Create method on the base type instead.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public sealed partial class SHA1CryptoServiceProvider : System.Security.Cryptography.SHA1 { @@ -244,7 +244,7 @@ protected override void HashCore(System.ReadOnlySpan source) { } public override void Initialize() { } protected override bool TryHashFinal(System.Span destination, out int bytesWritten) { throw null; } } - [System.ObsoleteAttribute("Derived cryptographic types are obsolete. Use the Create method on the underlying type instead.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] + [System.ObsoleteAttribute("Derived cryptographic types are obsolete. Use the Create method on the base type instead.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public sealed partial class SHA256CryptoServiceProvider : System.Security.Cryptography.SHA256 { @@ -256,7 +256,7 @@ protected override void HashCore(System.ReadOnlySpan source) { } public override void Initialize() { } protected override bool TryHashFinal(System.Span destination, out int bytesWritten) { throw null; } } - [System.ObsoleteAttribute("Derived cryptographic types are obsolete. Use the Create method on the underlying type instead.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] + [System.ObsoleteAttribute("Derived cryptographic types are obsolete. Use the Create method on the base type instead.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public sealed partial class SHA384CryptoServiceProvider : System.Security.Cryptography.SHA384 { @@ -268,7 +268,7 @@ protected override void HashCore(System.ReadOnlySpan source) { } public override void Initialize() { } protected override bool TryHashFinal(System.Span destination, out int bytesWritten) { throw null; } } - [System.ObsoleteAttribute("Derived cryptographic types are obsolete. Use the Create method on the underlying type instead.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] + [System.ObsoleteAttribute("Derived cryptographic types are obsolete. Use the Create method on the base type instead.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public sealed partial class SHA512CryptoServiceProvider : System.Security.Cryptography.SHA512 { @@ -280,7 +280,7 @@ protected override void HashCore(System.ReadOnlySpan source) { } public override void Initialize() { } protected override bool TryHashFinal(System.Span destination, out int bytesWritten) { throw null; } } - [System.ObsoleteAttribute("Derived cryptographic types are obsolete. Use the Create method on the underlying type instead.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] + [System.ObsoleteAttribute("Derived cryptographic types are obsolete. Use the Create method on the base type instead.", DiagnosticId = "SYSLIB0021", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public sealed partial class TripleDESCryptoServiceProvider : System.Security.Cryptography.TripleDES { From 0d5a15383e61158e50f8d960b888abfa686cfeaf Mon Sep 17 00:00:00 2001 From: Jeff Handley Date: Mon, 10 May 2021 19:13:07 -0700 Subject: [PATCH 28/28] Remove duplicate Obsoletions.cs from project file (introduced in merge) --- .../src/System.Security.Cryptography.Csp.csproj | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/libraries/System.Security.Cryptography.Csp/src/System.Security.Cryptography.Csp.csproj b/src/libraries/System.Security.Cryptography.Csp/src/System.Security.Cryptography.Csp.csproj index 99991b8223cc2..2e8119ae25704 100644 --- a/src/libraries/System.Security.Cryptography.Csp/src/System.Security.Cryptography.Csp.csproj +++ b/src/libraries/System.Security.Cryptography.Csp/src/System.Security.Cryptography.Csp.csproj @@ -33,8 +33,6 @@ Link="Common\System\Security\Cryptography\KeySizeHelpers.cs" /> -