Skip to content

Commit

Permalink
Dead end S.Security.Cryptography.OpenSsl package (#51854)
Browse files Browse the repository at this point in the history
* 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 #47530
  • Loading branch information
ViktorHofer authored Apr 26, 2021
1 parent d03dcdd commit 7b575d7
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 120 deletions.
1 change: 0 additions & 1 deletion src/libraries/NetCoreAppLibrary.props
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@
System.IO.Pipes.AccessControl;
System.Security.AccessControl;
System.Security.Cryptography.Cng;
System.Security.Cryptography.OpenSsl;
System.Security.Principal.Windows;
</NetCoreAppLibraryNoReference>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,5 @@
<StrongNameKeyId>Microsoft</StrongNameKeyId>
<IncludePlatformAttributes>true</IncludePlatformAttributes>
<UnsupportedOSPlatforms>windows;browser;android;ios;tvos</UnsupportedOSPlatforms>
<PackageDescription>Provides cryptographic algorithm implementations and key management for non-Windows systems with OpenSSL.

Commonly Used Types:
System.Security.Cryptography.RSAOpenSsl</PackageDescription>
</PropertyGroup>
</Project>
12 changes: 0 additions & 12 deletions src/libraries/System.Security.Cryptography.OpenSsl/NuGet.config

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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) { }
Expand All @@ -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) { }
Expand All @@ -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) { }
Expand All @@ -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; }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>$(NetCoreAppCurrent);netcoreapp3.0;net47</TargetFrameworks>
<ExcludeCurrentNetCoreAppFromPackage>true</ExcludeCurrentNetCoreAppFromPackage>
<TargetFrameworks>$(NetCoreAppCurrent)</TargetFrameworks>
<Nullable>enable</Nullable>
</PropertyGroup>
<PropertyGroup>
<AssemblyVersion Condition="$(TargetFramework.StartsWith('net4'))">4.1.0.0</AssemblyVersion>
<!-- We need to build against net47 because that is where ECParameters got added inbox. We ship as net461 in order to not require
the facades when the package is restored. -->
<PackageTargetFramework Condition="'$(TargetFramework)' == 'net47'">net461</PackageTargetFramework>
</PropertyGroup>
<ItemGroup>
<SuppressPackageTargetFrameworkCompatibility Include="net461" />
<Compile Include="System.Security.Cryptography.OpenSsl.cs" />
<Compile Include="System.Security.Cryptography.OpenSsl.netcoreapp.cs" Condition="'$(TargetFramework)' == 'netcoreapp3.0' OR '$(TargetFramework)' == '$(NetCoreAppCurrent)'" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == '$(NetCoreAppCurrent)'">
<ItemGroup>
<ProjectReference Include="$(LibrariesProjectRoot)System.Runtime\ref\System.Runtime.csproj" />
<ProjectReference Include="$(LibrariesProjectRoot)System.Security.Cryptography.Algorithms\ref\System.Security.Cryptography.Algorithms.csproj" />
<ProjectReference Include="$(LibrariesProjectRoot)System.Security.Cryptography.Primitives\ref\System.Security.Cryptography.Primitives.csproj" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.0'">
<Reference Include="System.IO" />
<Reference Include="System.Runtime" />
<Reference Include="System.Runtime.Handles" />
<Reference Include="System.Security.Cryptography.Algorithms" />
<Reference Include="System.Security.Cryptography.Primitives" />
</ItemGroup>
</Project>

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,23 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-Android;$(NetCoreAppCurrent)-iOS;$(NetCoreAppCurrent)-tvOS;$(NetCoreAppCurrent)</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<TargetFrameworks>$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-Android;$(NetCoreAppCurrent)-iOS;$(NetCoreAppCurrent)-tvOS;netcoreapp3.0-Unix;netcoreapp3.0;net47</TargetFrameworks>
<ExcludeCurrentNetCoreAppFromPackage>true</ExcludeCurrentNetCoreAppFromPackage>
<Nullable>enable</Nullable>
</PropertyGroup>
<!-- DesignTimeBuild requires all the TargetFramework Derived Properties to not be present in the first property group. -->
<PropertyGroup>
<AssemblyVersion Condition="$(TargetFramework.StartsWith('net4'))">4.1.0.0</AssemblyVersion>
<!-- We need to build against net47 because that is where ECParameters got added inbox. We ship as net461 in order to not require
the facades when the package is restored. -->
<PackageTargetFramework Condition="$(TargetFramework.StartsWith('net4'))">net461</PackageTargetFramework>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetsUnix)' != 'true' or '$(TargetsAndroid)' == 'true' or '$(TargetsiOS)' == 'true' or '$(TargetstvOS)' == 'true'">
<GeneratePlatformNotSupportedAssemblyMessage>SR.PlatformNotSupported_CryptographyOpenSSL</GeneratePlatformNotSupportedAssemblyMessage>
<UnsupportedPlatformTarget>true</UnsupportedPlatformTarget>
<!-- Clear PackageTargetRuntime on Windows to package the PlatformNotSupported assembly
without a RID so that it applies in desktop packages.config projects as well -->
<PackageTargetRuntime />
</PropertyGroup>
<Import Project="$(CommonPath)System\Security\Cryptography\Asn1Reader\System.Security.Cryptography.Asn1Reader.Shared.projitems" Condition="'$(UnsupportedPlatformTarget)' != 'true'" />
<ItemGroup Condition="'$(UnsupportedPlatformTarget)' != 'true'">
Expand Down Expand Up @@ -110,8 +99,7 @@
<Compile Include="$(CommonPath)System\Security\Cryptography\RsaPaddingProcessor.cs"
Link="Common\System\Security\Cryptography\RsaPaddingProcessor.cs" />
</ItemGroup>
<ItemGroup Condition="$(TargetFramework.StartsWith('$(NetCoreAppCurrent)')) or
$(TargetFramework.StartsWith('netcoreapp3.0'))">
<ItemGroup>
<ProjectReference Include="$(LibrariesProjectRoot)System.Formats.Asn1\src\System.Formats.Asn1.csproj" />
<Reference Include="System.Buffers" />
<Reference Include="System.Collections" />
Expand All @@ -130,7 +118,4 @@
<Reference Include="System.Text.Encoding.Extensions" />
<Reference Include="System.Threading" />
</ItemGroup>
<ItemGroup Condition="$(TargetFramework.StartsWith('net4'))">
<SuppressPackageTargetFrameworkCompatibility Include="net461" />
</ItemGroup>
</Project>
9 changes: 5 additions & 4 deletions src/libraries/pkg/baseline/packageIndex.json
Original file line number Diff line number Diff line change
Expand Up @@ -6166,17 +6166,18 @@
"4.7.0",
"5.0.0"
],
"BaselineVersion": "6.0.0",
"InboxOn": {},
"BaselineVersion": "5.0.0",
"InboxOn": {
"net6.0": "6.0.0.0"
},
"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"
"5.0.0.0": "5.0.0"
}
},
"System.Security.Cryptography.Pkcs": {
Expand Down

This file was deleted.

0 comments on commit 7b575d7

Please sign in to comment.