diff --git a/src/libraries/NetCoreAppLibrary.props b/src/libraries/NetCoreAppLibrary.props
index 3957b43596a9e..c488a78a05655 100644
--- a/src/libraries/NetCoreAppLibrary.props
+++ b/src/libraries/NetCoreAppLibrary.props
@@ -150,7 +150,6 @@
System.IO.FileSystem.AccessControl;
System.IO.Pipes.AccessControl;
System.Security.AccessControl;
- System.Security.Cryptography.Cng;
System.Security.Principal.Windows;
diff --git a/src/libraries/System.Security.Cryptography.Cng/Directory.Build.props b/src/libraries/System.Security.Cryptography.Cng/Directory.Build.props
index 5939d69e457ff..7bdd796606be8 100644
--- a/src/libraries/System.Security.Cryptography.Cng/Directory.Build.props
+++ b/src/libraries/System.Security.Cryptography.Cng/Directory.Build.props
@@ -4,11 +4,5 @@
Microsoft
true
windows
- Provides cryptographic algorithm implementations and key management with Windows Cryptographic Next Generation API (CNG).
-
-Commonly Used Types:
-System.Security.Cryptography.RSACng
-System.Security.Cryptography.ECDsaCng
-System.Security.Cryptography.CngKey
\ No newline at end of file
diff --git a/src/libraries/System.Security.Cryptography.Cng/NuGet.config b/src/libraries/System.Security.Cryptography.Cng/NuGet.config
deleted file mode 100644
index a66b7f9b01324..0000000000000
--- a/src/libraries/System.Security.Cryptography.Cng/NuGet.config
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/libraries/System.Security.Cryptography.Cng/pkg/System.Security.Cryptography.Cng.pkgproj b/src/libraries/System.Security.Cryptography.Cng/pkg/System.Security.Cryptography.Cng.pkgproj
deleted file mode 100644
index 66cb2acb38bd8..0000000000000
--- a/src/libraries/System.Security.Cryptography.Cng/pkg/System.Security.Cryptography.Cng.pkgproj
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
-
-
- net461;netcoreapp3.0
-
-
-
- runtimes/win/lib/uap10.0.16299
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/libraries/System.Security.Cryptography.Cng/ref/System.Security.Cryptography.Cng.cs b/src/libraries/System.Security.Cryptography.Cng/ref/System.Security.Cryptography.Cng.cs
index 7eec2ec85dd1c..66568a4158949 100644
--- a/src/libraries/System.Security.Cryptography.Cng/ref/System.Security.Cryptography.Cng.cs
+++ b/src/libraries/System.Security.Cryptography.Cng/ref/System.Security.Cryptography.Cng.cs
@@ -266,10 +266,8 @@ public DSACng(System.Security.Cryptography.CngKey key) { }
public override byte[] CreateSignature(byte[] rgbHash) { throw null; }
protected override void Dispose(bool disposing) { }
public override System.Security.Cryptography.DSAParameters ExportParameters(bool includePrivateParameters) { throw null; }
-#if FEATURE_DSA_HASHDATA
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; }
-#endif
public override void ImportParameters(System.Security.Cryptography.DSAParameters parameters) { }
public override bool VerifySignature(byte[] rgbHash, byte[] rgbSignature) { throw null; }
}
@@ -278,9 +276,7 @@ public sealed partial class ECDiffieHellmanCng : System.Security.Cryptography.EC
public ECDiffieHellmanCng() { }
public ECDiffieHellmanCng(int keySize) { }
public ECDiffieHellmanCng(System.Security.Cryptography.CngKey key) { }
-#if FEATURE_ECPARAMETERS
public ECDiffieHellmanCng(System.Security.Cryptography.ECCurve curve) { }
-#endif
public System.Security.Cryptography.CngAlgorithm HashAlgorithm { get { throw null; } set { } }
public byte[]? HmacKey { get { throw null; } set { } }
public System.Security.Cryptography.CngKey Key { get { throw null; } }
@@ -292,27 +288,19 @@ public ECDiffieHellmanCng(System.Security.Cryptography.ECCurve curve) { }
public byte[]? SecretPrepend { get { throw null; } set { } }
public byte[]? Seed { get { throw null; } set { } }
public bool UseSecretAgreementAsHmacKey { get { throw null; } }
-#if FEATURE_ECDH_DERIVEFROM
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; }
-#endif
public byte[] DeriveKeyMaterial(System.Security.Cryptography.CngKey otherPartyPublicKey) { throw null; }
public override byte[] DeriveKeyMaterial(System.Security.Cryptography.ECDiffieHellmanPublicKey otherPartyPublicKey) { throw null; }
-#if FEATURE_ECDH_DERIVEFROM
public override byte[] DeriveKeyTls(System.Security.Cryptography.ECDiffieHellmanPublicKey otherPartyPublicKey, byte[] prfLabel, byte[] prfSeed) { throw null; }
-#endif
public Microsoft.Win32.SafeHandles.SafeNCryptSecretHandle DeriveSecretAgreementHandle(System.Security.Cryptography.CngKey otherPartyPublicKey) { throw null; }
public Microsoft.Win32.SafeHandles.SafeNCryptSecretHandle DeriveSecretAgreementHandle(System.Security.Cryptography.ECDiffieHellmanPublicKey otherPartyPublicKey) { throw null; }
protected override void Dispose(bool disposing) { }
-#if FEATURE_ECPARAMETERS
public override System.Security.Cryptography.ECParameters ExportExplicitParameters(bool includePrivateParameters) { throw null; }
public override System.Security.Cryptography.ECParameters ExportParameters(bool includePrivateParameters) { throw null; }
-#endif
public void FromXmlString(string xml, System.Security.Cryptography.ECKeyXmlFormat format) { }
-#if FEATURE_ECPARAMETERS
public override void GenerateKey(System.Security.Cryptography.ECCurve curve) { }
public override void ImportParameters(System.Security.Cryptography.ECParameters parameters) { }
-#endif
public string ToXmlString(System.Security.Cryptography.ECKeyXmlFormat format) { throw null; }
}
public sealed partial class ECDiffieHellmanCngPublicKey : System.Security.Cryptography.ECDiffieHellmanPublicKey
@@ -321,10 +309,8 @@ public sealed partial class ECDiffieHellmanCngPublicKey : System.Security.Crypto
private ECDiffieHellmanCngPublicKey() : base(null) { }
public System.Security.Cryptography.CngKeyBlobFormat BlobFormat { get { throw null; } }
protected override void Dispose(bool disposing) { }
-#if FEATURE_ECPARAMETERS
public override System.Security.Cryptography.ECParameters ExportExplicitParameters() { throw null; }
public override System.Security.Cryptography.ECParameters ExportParameters() { throw null; }
-#endif
public static System.Security.Cryptography.ECDiffieHellmanPublicKey FromByteArray(byte[] publicKeyBlob, System.Security.Cryptography.CngKeyBlobFormat format) { throw null; }
public static System.Security.Cryptography.ECDiffieHellmanCngPublicKey FromXmlString(string xml) { throw null; }
public System.Security.Cryptography.CngKey Import() { throw null; }
@@ -341,27 +327,19 @@ public sealed partial class ECDsaCng : System.Security.Cryptography.ECDsa
public ECDsaCng() { }
public ECDsaCng(int keySize) { }
public ECDsaCng(System.Security.Cryptography.CngKey key) { }
-#if FEATURE_ECPARAMETERS // types missing from .NET Framework and net462 targeting pack
public ECDsaCng(System.Security.Cryptography.ECCurve curve) { }
-#endif
public System.Security.Cryptography.CngAlgorithm HashAlgorithm { get { throw null; } set { } }
public System.Security.Cryptography.CngKey Key { get { throw null; } }
public override int KeySize { get { throw null; } set { } }
public override System.Security.Cryptography.KeySizes[] LegalKeySizes { get { throw null; } }
protected override void Dispose(bool disposing) { }
-#if FEATURE_ECPARAMETERS // types missing from .NET Framework and net462 targeting pack
public override System.Security.Cryptography.ECParameters ExportExplicitParameters(bool includePrivateParameters) { throw null; }
public override System.Security.Cryptography.ECParameters ExportParameters(bool includePrivateParameters) { throw null; }
-#endif
public void FromXmlString(string xml, System.Security.Cryptography.ECKeyXmlFormat format) { }
-#if FEATURE_ECPARAMETERS // types missing from .NET Framework and net462 targeting pack
public override void GenerateKey(System.Security.Cryptography.ECCurve curve) { }
-#endif
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; }
-#if FEATURE_ECPARAMETERS // types missing from .NET Framework and net462 targeting pack
public override void ImportParameters(System.Security.Cryptography.ECParameters parameters) { }
-#endif
public byte[] SignData(byte[] data) { throw null; }
public byte[] SignData(byte[] data, int offset, int count) { throw null; }
public byte[] SignData(System.IO.Stream data) { throw null; }
diff --git a/src/libraries/System.Security.Cryptography.Cng/ref/System.Security.Cryptography.Cng.csproj b/src/libraries/System.Security.Cryptography.Cng/ref/System.Security.Cryptography.Cng.csproj
index 5828d68729988..1acaf24a448f0 100644
--- a/src/libraries/System.Security.Cryptography.Cng/ref/System.Security.Cryptography.Cng.csproj
+++ b/src/libraries/System.Security.Cryptography.Cng/ref/System.Security.Cryptography.Cng.csproj
@@ -1,31 +1,14 @@
- $(NetCoreAppCurrent);netcoreapp3.0;netstandard2.1;net461;net462;net47
- true
+ $(NetCoreAppCurrent)
enable
-
-
-
- $(DefineConstants);FEATURE_DSA_HASHDATA
-
- $(DefineConstants);FEATURE_ECDH_DERIVEFROM
- $(DefineConstants);FEATURE_ECPARAMETERS
- true
-
-
+
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/libraries/System.Security.Cryptography.Cng/src/ApiCompatBaseline.net461.txt b/src/libraries/System.Security.Cryptography.Cng/src/ApiCompatBaseline.net461.txt
deleted file mode 100644
index fd136b7a9275c..0000000000000
--- a/src/libraries/System.Security.Cryptography.Cng/src/ApiCompatBaseline.net461.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-TypesMustExist : Type 'System.Security.Cryptography.AesCng' does not exist in the implementation but it does exist in the contract.
-TypesMustExist : Type 'System.Security.Cryptography.DSACng' does not exist in the implementation but it does exist in the contract.
-TypesMustExist : Type 'System.Security.Cryptography.TripleDESCng' does not exist in the implementation but it does exist in the contract.
\ No newline at end of file
diff --git a/src/libraries/System.Security.Cryptography.Cng/src/System.Security.Cryptography.Cng.csproj b/src/libraries/System.Security.Cryptography.Cng/src/System.Security.Cryptography.Cng.csproj
index 32281e4cd5674..b4d0c91a2d246 100644
--- a/src/libraries/System.Security.Cryptography.Cng/src/System.Security.Cryptography.Cng.csproj
+++ b/src/libraries/System.Security.Cryptography.Cng/src/System.Security.Cryptography.Cng.csproj
@@ -1,22 +1,16 @@
+ $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)
true
- true
- $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent);netstandard2.1;net461-windows;netcoreapp3.0-windows;netcoreapp3.0;net462-windows;net47-windows
- true
enable
-
- true
- true
-
SR.PlatformNotSupported_CryptographyCng
-
-
-
+
+
+
@@ -353,11 +347,8 @@
-
+
-
-
diff --git a/src/libraries/System.Security.Cryptography.Cng/tests/ECDiffieHellmanCngProvider.cs b/src/libraries/System.Security.Cryptography.Cng/tests/ECDiffieHellmanCngProvider.cs
index 6159cc28e2244..0470ab527ebfc 100644
--- a/src/libraries/System.Security.Cryptography.Cng/tests/ECDiffieHellmanCngProvider.cs
+++ b/src/libraries/System.Security.Cryptography.Cng/tests/ECDiffieHellmanCngProvider.cs
@@ -15,12 +15,10 @@ public ECDiffieHellman Create(int keySize)
return new ECDiffieHellmanCng(keySize);
}
-#if NETCOREAPP
public ECDiffieHellman Create(ECCurve curve)
{
return new ECDiffieHellmanCng(curve);
}
-#endif
public bool IsCurveValid(Oid oid)
{
diff --git a/src/libraries/System.Security.Cryptography.Cng/tests/ECDiffieHellmanCngTests.cs b/src/libraries/System.Security.Cryptography.Cng/tests/ECDiffieHellmanCngTests.cs
index 90cc9eb976e31..aaab4f20594cb 100644
--- a/src/libraries/System.Security.Cryptography.Cng/tests/ECDiffieHellmanCngTests.cs
+++ b/src/libraries/System.Security.Cryptography.Cng/tests/ECDiffieHellmanCngTests.cs
@@ -13,7 +13,6 @@ private static ECDiffieHellmanCng NewDefaultECDHCng()
return new ECDiffieHellmanCng();
}
-#if NETCOREAPP
[Fact]
public static void ECCurve_ctor()
{
@@ -35,7 +34,6 @@ public static void ECCurve_ctor()
ecdh.Exercise();
}
}
-#endif
[Fact]
public static void CngKey_ReusesObject()
diff --git a/src/libraries/System.Security.Cryptography.Cng/tests/ECDsaCngImportExportTests.cs b/src/libraries/System.Security.Cryptography.Cng/tests/ECDsaCngImportExportTests.cs
index d296ac33028e4..a204cd15d0668 100644
--- a/src/libraries/System.Security.Cryptography.Cng/tests/ECDsaCngImportExportTests.cs
+++ b/src/libraries/System.Security.Cryptography.Cng/tests/ECDsaCngImportExportTests.cs
@@ -46,7 +46,6 @@ public static void TestImportExportRoundTrip()
}
}
-#if NETCOREAPP
[ConditionalTheory(nameof(ECExplicitCurvesSupported)), MemberData(nameof(TestCurves))]
public static void TestHashRoundTrip(CurveDef curveDef)
{
@@ -69,6 +68,5 @@ public static void TestHashRoundTrip(CurveDef curveDef)
Assert.Equal(0xFF, param2.Curve.Seed[0]);
}
}
-#endif
}
}
diff --git a/src/libraries/System.Security.Cryptography.Cng/tests/ECDsaCngProvider.cs b/src/libraries/System.Security.Cryptography.Cng/tests/ECDsaCngProvider.cs
index ef6cf9fadba3f..b6d68a288a4a4 100644
--- a/src/libraries/System.Security.Cryptography.Cng/tests/ECDsaCngProvider.cs
+++ b/src/libraries/System.Security.Cryptography.Cng/tests/ECDsaCngProvider.cs
@@ -15,12 +15,10 @@ public ECDsa Create(int keySize)
return new ECDsaCng(keySize);
}
-#if NETCOREAPP
public ECDsa Create(ECCurve curve)
{
return new ECDsaCng(curve);
}
-#endif
public bool IsCurveValid(Oid oid)
{
diff --git a/src/libraries/System.Security.Cryptography.Cng/tests/ECDsaCngTests.cs b/src/libraries/System.Security.Cryptography.Cng/tests/ECDsaCngTests.cs
index 78ad6444b202f..c7ff78e8d02bd 100644
--- a/src/libraries/System.Security.Cryptography.Cng/tests/ECDsaCngTests.cs
+++ b/src/libraries/System.Security.Cryptography.Cng/tests/ECDsaCngTests.cs
@@ -156,7 +156,6 @@ public static void HashAlgorithm_DefaultsToSha256()
Assert.Equal(CngAlgorithm.Sha256, cng.HashAlgorithm);
}
-#if NETCOREAPP
[Fact]
public static void TestPositive256WithBlob()
{
@@ -211,7 +210,6 @@ public static void TestSpecialNistKeys(int keySize, string curveName, CngAlgorit
Assert.Equal(algorithm, cng.Key.Algorithm);
}
}
-#endif
public static IEnumerable