From 0c7b8b61e9f1e83bfefeddbe10b4bee08c6b0e5d Mon Sep 17 00:00:00 2001 From: Viktor Hofer Date: Mon, 26 Apr 2021 12:36:29 +0200 Subject: [PATCH 1/3] Dead end S.Security.Cryptography.OpenSsl package To reduce complexity of the cryptography OpenSsl library, dead ending its package as most of the configurations are partial facades anyway and adding OpenSsl to the targeting pack. It's already part of the runtime and exposed in aspnetcore's targeting pack. .NET Standard libraries can continue to use the latest available package which harvests for .NET Standard configurations. Contributes to https://github.com/dotnet/runtime/issues/47530 --- src/libraries/NetCoreAppLibrary.props | 1 - .../Directory.Build.props | 4 --- .../NuGet.config | 12 ------- ...stem.Security.Cryptography.OpenSsl.pkgproj | 18 ---------- .../System.Security.Cryptography.OpenSsl.cs | 29 ++++++++++++--- ...ystem.Security.Cryptography.OpenSsl.csproj | 20 ++--------- ...ecurity.Cryptography.OpenSsl.netcoreapp.cs | 36 ------------------- ...ystem.Security.Cryptography.OpenSsl.csproj | 19 ++-------- src/libraries/pkg/baseline/packageIndex.json | 26 -------------- .../netcoreapp1.0/workaroundDowngrade.targets | 6 ---- 10 files changed, 29 insertions(+), 142 deletions(-) delete mode 100644 src/libraries/System.Security.Cryptography.OpenSsl/NuGet.config delete mode 100644 src/libraries/System.Security.Cryptography.OpenSsl/pkg/System.Security.Cryptography.OpenSsl.pkgproj delete mode 100644 src/libraries/System.Security.Cryptography.OpenSsl/ref/System.Security.Cryptography.OpenSsl.netcoreapp.cs delete mode 100644 src/libraries/pkg/test/packageSettings/System.Security.Cryptography.OpenSsl/netcoreapp1.0/workaroundDowngrade.targets diff --git a/src/libraries/NetCoreAppLibrary.props b/src/libraries/NetCoreAppLibrary.props index 6bd027958addea..3957b43596a9e4 100644 --- a/src/libraries/NetCoreAppLibrary.props +++ b/src/libraries/NetCoreAppLibrary.props @@ -151,7 +151,6 @@ System.IO.Pipes.AccessControl; System.Security.AccessControl; System.Security.Cryptography.Cng; - System.Security.Cryptography.OpenSsl; System.Security.Principal.Windows; diff --git a/src/libraries/System.Security.Cryptography.OpenSsl/Directory.Build.props b/src/libraries/System.Security.Cryptography.OpenSsl/Directory.Build.props index d3efdf2d11994a..1e1390709dcc5b 100644 --- a/src/libraries/System.Security.Cryptography.OpenSsl/Directory.Build.props +++ b/src/libraries/System.Security.Cryptography.OpenSsl/Directory.Build.props @@ -4,9 +4,5 @@ Microsoft true windows;browser;android;ios;tvos - Provides cryptographic algorithm implementations and key management for non-Windows systems with OpenSSL. - -Commonly Used Types: -System.Security.Cryptography.RSAOpenSsl diff --git a/src/libraries/System.Security.Cryptography.OpenSsl/NuGet.config b/src/libraries/System.Security.Cryptography.OpenSsl/NuGet.config deleted file mode 100644 index a66b7f9b013241..00000000000000 --- a/src/libraries/System.Security.Cryptography.OpenSsl/NuGet.config +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/src/libraries/System.Security.Cryptography.OpenSsl/pkg/System.Security.Cryptography.OpenSsl.pkgproj b/src/libraries/System.Security.Cryptography.OpenSsl/pkg/System.Security.Cryptography.OpenSsl.pkgproj deleted file mode 100644 index e934cc2a057cfa..00000000000000 --- a/src/libraries/System.Security.Cryptography.OpenSsl/pkg/System.Security.Cryptography.OpenSsl.pkgproj +++ /dev/null @@ -1,18 +0,0 @@ - - - - - netcoreapp3.0 - - - - - - - - - - - - \ No newline at end of file diff --git a/src/libraries/System.Security.Cryptography.OpenSsl/ref/System.Security.Cryptography.OpenSsl.cs b/src/libraries/System.Security.Cryptography.OpenSsl/ref/System.Security.Cryptography.OpenSsl.cs index 902fa8f3f698a4..49a2aa2e1bbf20 100644 --- a/src/libraries/System.Security.Cryptography.OpenSsl/ref/System.Security.Cryptography.OpenSsl.cs +++ b/src/libraries/System.Security.Cryptography.OpenSsl/ref/System.Security.Cryptography.OpenSsl.cs @@ -6,7 +6,7 @@ namespace System.Security.Cryptography { - public sealed partial class DSAOpenSsl : System.Security.Cryptography.DSA + public sealed class DSAOpenSsl : System.Security.Cryptography.DSA { public DSAOpenSsl() { } public DSAOpenSsl(int keySize) { } @@ -19,10 +19,30 @@ public override int KeySize { set { } } protected override void Dispose(bool disposing) { } public System.Security.Cryptography.SafeEvpPKeyHandle DuplicateKeyHandle() { throw null; } public override System.Security.Cryptography.DSAParameters ExportParameters(bool includePrivateParameters) { throw null; } + protected override byte[] HashData(byte[] data, int offset, int count, System.Security.Cryptography.HashAlgorithmName hashAlgorithm) { throw null; } + protected override byte[] HashData(System.IO.Stream data, System.Security.Cryptography.HashAlgorithmName hashAlgorithm) { throw null; } public override void ImportParameters(System.Security.Cryptography.DSAParameters parameters) { } public override bool VerifySignature(byte[] rgbHash, byte[] rgbSignature) { throw null; } } - public sealed partial class ECDsaOpenSsl : System.Security.Cryptography.ECDsa + public sealed class ECDiffieHellmanOpenSsl : System.Security.Cryptography.ECDiffieHellman + { + public ECDiffieHellmanOpenSsl() { } + public ECDiffieHellmanOpenSsl(int keySize) { } + public ECDiffieHellmanOpenSsl(System.IntPtr handle) { } + public ECDiffieHellmanOpenSsl(System.Security.Cryptography.ECCurve curve) { } + public ECDiffieHellmanOpenSsl(System.Security.Cryptography.SafeEvpPKeyHandle pkeyHandle) { } + public override System.Security.Cryptography.ECDiffieHellmanPublicKey PublicKey { get { throw null; } } + public override byte[] DeriveKeyFromHash(System.Security.Cryptography.ECDiffieHellmanPublicKey otherPartyPublicKey, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, byte[]? secretPrepend, byte[]? secretAppend) { throw null; } + public override byte[] DeriveKeyFromHmac(System.Security.Cryptography.ECDiffieHellmanPublicKey otherPartyPublicKey, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, byte[]? hmacKey, byte[]? secretPrepend, byte[]? secretAppend) { throw null; } + public override byte[] DeriveKeyMaterial(System.Security.Cryptography.ECDiffieHellmanPublicKey otherPartyPublicKey) { throw null; } + public override byte[] DeriveKeyTls(System.Security.Cryptography.ECDiffieHellmanPublicKey otherPartyPublicKey, byte[] prfLabel, byte[] prfSeed) { throw null; } + public System.Security.Cryptography.SafeEvpPKeyHandle DuplicateKeyHandle() { throw null; } + public override System.Security.Cryptography.ECParameters ExportExplicitParameters(bool includePrivateParameters) { throw null; } + public override System.Security.Cryptography.ECParameters ExportParameters(bool includePrivateParameters) { throw null; } + public override void GenerateKey(System.Security.Cryptography.ECCurve curve) { } + public override void ImportParameters(System.Security.Cryptography.ECParameters parameters) { } + } + public sealed class ECDsaOpenSsl : System.Security.Cryptography.ECDsa { public ECDsaOpenSsl() { } public ECDsaOpenSsl(int keySize) { } @@ -42,7 +62,7 @@ public override void ImportParameters(System.Security.Cryptography.ECParameters public override byte[] SignHash(byte[] hash) { throw null; } public override bool VerifyHash(byte[] hash, byte[] signature) { throw null; } } - public sealed partial class RSAOpenSsl : System.Security.Cryptography.RSA + public sealed class RSAOpenSsl : System.Security.Cryptography.RSA { public RSAOpenSsl() { } public RSAOpenSsl(int keySize) { } @@ -62,10 +82,11 @@ public override void ImportParameters(System.Security.Cryptography.RSAParameters public override byte[] SignHash(byte[] hash, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.RSASignaturePadding padding) { throw null; } public override bool VerifyHash(byte[] hash, byte[] signature, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.RSASignaturePadding padding) { throw null; } } - public sealed partial class SafeEvpPKeyHandle : System.Runtime.InteropServices.SafeHandle + public sealed class SafeEvpPKeyHandle : System.Runtime.InteropServices.SafeHandle { public SafeEvpPKeyHandle() : base (default(System.IntPtr), default(bool)) { } public SafeEvpPKeyHandle(System.IntPtr handle, bool ownsHandle) : base (default(System.IntPtr), default(bool)) { } + public static long OpenSslVersion { get { throw null; } } public override bool IsInvalid { get { throw null; } } public System.Security.Cryptography.SafeEvpPKeyHandle DuplicateHandle() { throw null; } protected override bool ReleaseHandle() { throw null; } diff --git a/src/libraries/System.Security.Cryptography.OpenSsl/ref/System.Security.Cryptography.OpenSsl.csproj b/src/libraries/System.Security.Cryptography.OpenSsl/ref/System.Security.Cryptography.OpenSsl.csproj index 1465cb0fabc90a..0388ce3b602210 100644 --- a/src/libraries/System.Security.Cryptography.OpenSsl/ref/System.Security.Cryptography.OpenSsl.csproj +++ b/src/libraries/System.Security.Cryptography.OpenSsl/ref/System.Security.Cryptography.OpenSsl.csproj @@ -1,30 +1,14 @@ - $(NetCoreAppCurrent);netcoreapp3.0;net47 - true + $(NetCoreAppCurrent) enable - - 4.1.0.0 - - net461 - - - - + - - - - - - - diff --git a/src/libraries/System.Security.Cryptography.OpenSsl/ref/System.Security.Cryptography.OpenSsl.netcoreapp.cs b/src/libraries/System.Security.Cryptography.OpenSsl/ref/System.Security.Cryptography.OpenSsl.netcoreapp.cs deleted file mode 100644 index e8a0b899af6466..00000000000000 --- a/src/libraries/System.Security.Cryptography.OpenSsl/ref/System.Security.Cryptography.OpenSsl.netcoreapp.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// ------------------------------------------------------------------------------ -// Changes to this file must follow the https://aka.ms/api-review process. -// ------------------------------------------------------------------------------ - -namespace System.Security.Cryptography -{ - public sealed partial class DSAOpenSsl : System.Security.Cryptography.DSA - { - protected override byte[] HashData(byte[] data, int offset, int count, System.Security.Cryptography.HashAlgorithmName hashAlgorithm) { throw null; } - protected override byte[] HashData(System.IO.Stream data, System.Security.Cryptography.HashAlgorithmName hashAlgorithm) { throw null; } - } - public sealed partial class ECDiffieHellmanOpenSsl : System.Security.Cryptography.ECDiffieHellman - { - public ECDiffieHellmanOpenSsl() { } - public ECDiffieHellmanOpenSsl(int keySize) { } - public ECDiffieHellmanOpenSsl(System.IntPtr handle) { } - public ECDiffieHellmanOpenSsl(System.Security.Cryptography.ECCurve curve) { } - public ECDiffieHellmanOpenSsl(System.Security.Cryptography.SafeEvpPKeyHandle pkeyHandle) { } - public override System.Security.Cryptography.ECDiffieHellmanPublicKey PublicKey { get { throw null; } } - public override byte[] DeriveKeyFromHash(System.Security.Cryptography.ECDiffieHellmanPublicKey otherPartyPublicKey, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, byte[]? secretPrepend, byte[]? secretAppend) { throw null; } - public override byte[] DeriveKeyFromHmac(System.Security.Cryptography.ECDiffieHellmanPublicKey otherPartyPublicKey, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, byte[]? hmacKey, byte[]? secretPrepend, byte[]? secretAppend) { throw null; } - public override byte[] DeriveKeyMaterial(System.Security.Cryptography.ECDiffieHellmanPublicKey otherPartyPublicKey) { throw null; } - public override byte[] DeriveKeyTls(System.Security.Cryptography.ECDiffieHellmanPublicKey otherPartyPublicKey, byte[] prfLabel, byte[] prfSeed) { throw null; } - public System.Security.Cryptography.SafeEvpPKeyHandle DuplicateKeyHandle() { throw null; } - public override System.Security.Cryptography.ECParameters ExportExplicitParameters(bool includePrivateParameters) { throw null; } - public override System.Security.Cryptography.ECParameters ExportParameters(bool includePrivateParameters) { throw null; } - public override void GenerateKey(System.Security.Cryptography.ECCurve curve) { } - public override void ImportParameters(System.Security.Cryptography.ECParameters parameters) { } - } - public sealed partial class SafeEvpPKeyHandle : System.Runtime.InteropServices.SafeHandle - { - public static long OpenSslVersion { get { throw null; } } - } -} diff --git a/src/libraries/System.Security.Cryptography.OpenSsl/src/System.Security.Cryptography.OpenSsl.csproj b/src/libraries/System.Security.Cryptography.OpenSsl/src/System.Security.Cryptography.OpenSsl.csproj index 1f7b3c1415cf32..133c02e87c4fb9 100644 --- a/src/libraries/System.Security.Cryptography.OpenSsl/src/System.Security.Cryptography.OpenSsl.csproj +++ b/src/libraries/System.Security.Cryptography.OpenSsl/src/System.Security.Cryptography.OpenSsl.csproj @@ -1,23 +1,12 @@ + $(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-Android;$(NetCoreAppCurrent)-iOS;$(NetCoreAppCurrent)-tvOS;$(NetCoreAppCurrent) true - $(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-Android;$(NetCoreAppCurrent)-iOS;$(NetCoreAppCurrent)-tvOS;netcoreapp3.0-Unix;netcoreapp3.0;net47 - true enable - - - 4.1.0.0 - - net461 - SR.PlatformNotSupported_CryptographyOpenSSL true - - @@ -110,8 +99,7 @@ - + @@ -130,7 +118,4 @@ - - - diff --git a/src/libraries/pkg/baseline/packageIndex.json b/src/libraries/pkg/baseline/packageIndex.json index a9476f29b81f17..dfcbcd5e9e8e07 100644 --- a/src/libraries/pkg/baseline/packageIndex.json +++ b/src/libraries/pkg/baseline/packageIndex.json @@ -6153,32 +6153,6 @@ "4.0.1.0": "4.3.0" } }, - "System.Security.Cryptography.OpenSsl": { - "StableVersions": [ - "4.0.0", - "4.0.1", - "4.3.0", - "4.3.1", - "4.4.0", - "4.5.0", - "4.5.1", - "4.6.0", - "4.7.0", - "5.0.0" - ], - "BaselineVersion": "6.0.0", - "InboxOn": {}, - "AssemblyVersionInPackageVersion": { - "4.0.0.0": "4.0.0", - "4.0.1.0": "4.3.0", - "4.1.0.0": "4.4.0", - "4.1.1.0": "4.5.0", - "4.1.1.1": "4.5.1", - "4.1.2.0": "4.6.0", - "5.0.0.0": "5.0.0", - "6.0.0.0": "6.0.0" - } - }, "System.Security.Cryptography.Pkcs": { "StableVersions": [ "4.0.0", diff --git a/src/libraries/pkg/test/packageSettings/System.Security.Cryptography.OpenSsl/netcoreapp1.0/workaroundDowngrade.targets b/src/libraries/pkg/test/packageSettings/System.Security.Cryptography.OpenSsl/netcoreapp1.0/workaroundDowngrade.targets deleted file mode 100644 index 2f4f96679a9c79..00000000000000 --- a/src/libraries/pkg/test/packageSettings/System.Security.Cryptography.OpenSsl/netcoreapp1.0/workaroundDowngrade.targets +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file From 7b3b1272c4a9f5775fe12fa2bede8ae298fd474f Mon Sep 17 00:00:00 2001 From: Viktor Hofer Date: Mon, 26 Apr 2021 16:52:57 +0200 Subject: [PATCH 2/3] Revert packageindex update and remove 6.0 version --- src/libraries/pkg/baseline/packageIndex.json | 25 ++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/libraries/pkg/baseline/packageIndex.json b/src/libraries/pkg/baseline/packageIndex.json index dfcbcd5e9e8e07..8848a3e1887645 100644 --- a/src/libraries/pkg/baseline/packageIndex.json +++ b/src/libraries/pkg/baseline/packageIndex.json @@ -6153,6 +6153,31 @@ "4.0.1.0": "4.3.0" } }, + "System.Security.Cryptography.OpenSsl": { + "StableVersions": [ + "4.0.0", + "4.0.1", + "4.3.0", + "4.3.1", + "4.4.0", + "4.5.0", + "4.5.1", + "4.6.0", + "4.7.0", + "5.0.0" + ], + "BaselineVersion": "5.0.0", + "InboxOn": {}, + "AssemblyVersionInPackageVersion": { + "4.0.0.0": "4.0.0", + "4.0.1.0": "4.3.0", + "4.1.0.0": "4.4.0", + "4.1.1.0": "4.5.0", + "4.1.1.1": "4.5.1", + "4.1.2.0": "4.6.0", + "5.0.0.0": "5.0.0" + } + }, "System.Security.Cryptography.Pkcs": { "StableVersions": [ "4.0.0", From 757d69a03a72686adc2949bf33d53bf05aaf046e Mon Sep 17 00:00:00 2001 From: Viktor Hofer Date: Mon, 26 Apr 2021 18:10:49 +0200 Subject: [PATCH 3/3] Add inbox version --- src/libraries/pkg/baseline/packageIndex.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/libraries/pkg/baseline/packageIndex.json b/src/libraries/pkg/baseline/packageIndex.json index 8848a3e1887645..23d23bb5007933 100644 --- a/src/libraries/pkg/baseline/packageIndex.json +++ b/src/libraries/pkg/baseline/packageIndex.json @@ -6167,7 +6167,9 @@ "5.0.0" ], "BaselineVersion": "5.0.0", - "InboxOn": {}, + "InboxOn": { + "net6.0": "6.0.0.0" + }, "AssemblyVersionInPackageVersion": { "4.0.0.0": "4.0.0", "4.0.1.0": "4.3.0",