Add S.S.C.Pkcs and S.S.C.Cng netstandard2.1 ref and lib (dotnet/corefx#38439)
authorJeremy Barton <jbarton@microsoft.com>
Sat, 15 Jun 2019 17:28:23 +0000 (10:28 -0700)
committermsftbot[bot] <msftbot[bot]@users.noreply.github.com>
Sat, 15 Jun 2019 17:28:23 +0000 (17:28 +0000)
* Add S.S.C.Pkcs and S.S.C.Cng netstandard2.1 ref and lib

The netstandard2.1 ref is equivalent to the netcoreapp3.0 ref in these two
OOB packages.

Ref changes:

Cng:
* Adds DSACng and ECDiffieHellmanCng (and related types)

Pkcs:
* Adds RSA-OAEP option to CmsRecipient
* Adds custom private key option to CmsSigner
* Adds custom private key decrypt option to EnvelopedCms
* Adds Pkcs12Info and Pkcs12Builder (and associated types)
* Adds Pkcs8PrivateKeyInfo
* Adds RFC3161 timestamp types
* Adds AddCertificate/RemoveCertificate to SignedCms
* Adds AddUnsignedAttribute/RemoveUnsignedAttribute to SignerInfo
* Adds SignatureAlgorithm/GetSignature to SignerInfo
* Adds MatchesCertificate to SubjectIdentifier

Impl changes:

Cng:
* The netstandard2.1 impl is a generated PNSE, the real impl is inbox on Windows.

Pkcs:
* The impls are the same as the netcoreapp3.0 impls, but are required
because netstandard2.0 is a better match for netstandard2.1 than netcoreapp3.0 is.

* Use shared netstandard21 DefineConstant

* Add netstandard2.1 to ref AdditionalBuildConfigurations

Commit migrated from https://github.com/dotnet/corefx/commit/985334c90d6b181cd47cd42c4c958d9dd34ab90b

20 files changed:
src/libraries/Common/src/System/Security/Cryptography/Asn1Reader/AsnCharacterStringEncodings.cs
src/libraries/Common/src/System/Security/Cryptography/Asn1Reader/AsnWriter.BitString.cs
src/libraries/Common/src/System/Security/Cryptography/CryptoPool.cs
src/libraries/System.Security.Cryptography.Cng/ref/Configurations.props
src/libraries/System.Security.Cryptography.Cng/ref/System.Security.Cryptography.Cng.csproj
src/libraries/System.Security.Cryptography.Cng/src/Configurations.props
src/libraries/System.Security.Cryptography.Cng/src/System.Security.Cryptography.Cng.csproj
src/libraries/System.Security.Cryptography.Pkcs/ref/Configurations.props
src/libraries/System.Security.Cryptography.Pkcs/ref/System.Security.Cryptography.Pkcs.csproj
src/libraries/System.Security.Cryptography.Pkcs/src/Configurations.props
src/libraries/System.Security.Cryptography.Pkcs/src/Internal/Cryptography/Pal/AnyOS/ManagedPal.KeyTrans.cs
src/libraries/System.Security.Cryptography.Pkcs/src/Internal/Cryptography/Pal/AnyOS/ManagedPal.cs
src/libraries/System.Security.Cryptography.Pkcs/src/Internal/Cryptography/PkcsHelpers.cs
src/libraries/System.Security.Cryptography.Pkcs/src/System.Security.Cryptography.Pkcs.csproj
src/libraries/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/CmsSignature.DSA.cs
src/libraries/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/CmsSignature.ECDsa.cs
src/libraries/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/CmsSignature.RSA.cs
src/libraries/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/CmsSignature.cs
src/libraries/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/SignerInfo.cs
src/libraries/ref.builds

index bcaffa5..25954b4 100644 (file)
@@ -65,7 +65,7 @@ namespace System.Security.Cryptography.Asn1
         }
 
         public
-#if netcoreapp || uap || NETCOREAPP
+#if netcoreapp || uap || NETCOREAPP || netstandard21
             override
 #endif
         int GetByteCount(ReadOnlySpan<char> chars)
@@ -100,7 +100,7 @@ namespace System.Security.Cryptography.Asn1
         }
 
         public
-#if netcoreapp || uap || NETCOREAPP
+#if netcoreapp || uap || NETCOREAPP || netstandard21
             override
 #endif
         int GetCharCount(ReadOnlySpan<byte> bytes)
@@ -394,7 +394,7 @@ namespace System.Security.Cryptography.Asn1
             return s_utf8Encoding.GetByteCount(s);
         }
 
-#if netcoreapp || uap || NETCOREAPP
+#if netcoreapp || uap || NETCOREAPP || netstandard21
         public override int GetByteCount(ReadOnlySpan<char> chars)
         {
             return s_utf8Encoding.GetByteCount(chars);
@@ -435,7 +435,7 @@ namespace System.Security.Cryptography.Asn1
             }
         }
 
-#if netcoreapp || uap || NETCOREAPP
+#if netcoreapp || uap || NETCOREAPP || netstandard21
         public override int GetCharCount(ReadOnlySpan<byte> bytes)
         {
             try
index a5a0675..ea54594 100644 (file)
@@ -117,7 +117,7 @@ namespace System.Security.Cryptography.Asn1
             _offset += bitString.Length;
         }
 
-#if netcoreapp || uap || NETCOREAPP
+#if netcoreapp || uap || NETCOREAPP || netstandard21
         /// <summary>
         ///   Write a Bit String value via a callback, with a tag UNIVERSAL 3.
         /// </summary>
index 9d6413e..ffe7319 100644 (file)
@@ -20,7 +20,7 @@ namespace System.Security.Cryptography
 
             if (!clearWholeArray && clearSize != 0)
             {
-#if netcoreapp || uap || NETCOREAPP
+#if netcoreapp || uap || NETCOREAPP || netstandard21
                 CryptographicOperations.ZeroMemory(array.AsSpan(0, clearSize));
 #else
                 Array.Clear(array, 0, clearSize);
index b917a74..950f010 100644 (file)
@@ -2,6 +2,7 @@
   <PropertyGroup>
     <PackageConfigurations>
       netcoreapp;
+      netstandard2.1;
       net461;
       net462;
       net47;
@@ -12,4 +13,4 @@
       uap;
     </BuildConfigurations>
   </PropertyGroup>
-</Project>
\ No newline at end of file
+</Project>
index fb75986..fc71335 100644 (file)
@@ -3,11 +3,11 @@
     <DefineConstants Condition="'$(TargetGroup)' != 'net461' AND '$(TargetGroup)' != 'net462'">$(DefineConstants);FEATURE_ECPARAMETERS</DefineConstants>
     <ProjectGuid>{9FD12550-3A7C-49D3-9A1E-C4B7410989DD}</ProjectGuid>
     <!-- FEATURE_DSA_HASHDATA is technically also available on net462+, but it doesn't require being enabled since it is a facade -->
-    <DefineConstants Condition="'$(TargetGroup)' == 'uap' Or '$(TargetGroup)' == 'netcoreapp'">$(DefineConstants);FEATURE_DSA_HASHDATA</DefineConstants>
+    <DefineConstants Condition="'$(TargetGroup)' == 'uap' Or '$(TargetGroup)' == 'netcoreapp' OR '$(TargetsNetStandard)' == 'true'">$(DefineConstants);FEATURE_DSA_HASHDATA</DefineConstants>
     <!-- FEATURE_ECDH_DERIVEFROM is technically also available on net462+, but it doesn't require being enabled since it is a facade -->
-    <DefineConstants Condition="'$(TargetGroup)' == 'uap' Or '$(TargetGroup)' == 'netcoreapp'">$(DefineConstants);FEATURE_ECDH_DERIVEFROM</DefineConstants>
+    <DefineConstants Condition="'$(TargetGroup)' == 'uap' Or '$(TargetGroup)' == 'netcoreapp' OR '$(TargetsNetStandard)' == 'true'">$(DefineConstants);FEATURE_ECDH_DERIVEFROM</DefineConstants>
     <IsPartialFacadeAssembly Condition="'$(TargetsNetFx)' == 'true'">true</IsPartialFacadeAssembly>
-    <Configurations>net461-Debug;net461-Release;net462-Debug;net462-Release;net47-Debug;net47-Release;netcoreapp-Debug;netcoreapp-Release;netfx-Debug;netfx-Release;uap-Debug;uap-Release</Configurations>
+    <Configurations>net461-Debug;net461-Release;net462-Debug;net462-Release;net47-Debug;net47-Release;netcoreapp-Debug;netcoreapp-Release;netfx-Debug;netfx-Release;netstandard2.1-Debug;netstandard2.1-Release;uap-Debug;uap-Release</Configurations>
   </PropertyGroup>
   <ItemGroup>
     <Compile Include="System.Security.Cryptography.Cng.cs" />
index 54f2a9c..d8379d9 100644 (file)
@@ -2,6 +2,7 @@
   <PropertyGroup>
     <PackageConfigurations>
       netstandard;
+      netstandard2.1;
       net461-Windows_NT;
       netcoreapp-Windows_NT;
       netcoreapp;
@@ -14,4 +15,4 @@
       uap-Windows_NT;
     </BuildConfigurations>
   </PropertyGroup>
-</Project>
\ No newline at end of file
+</Project>
index 581bd6b..cc566e1 100644 (file)
@@ -7,7 +7,7 @@
     <IsPartialFacadeAssembly Condition="'$(TargetsNetFx)' == 'true'">true</IsPartialFacadeAssembly>
     <OmitResources Condition="'$(IsPartialFacadeAssembly)' == 'true'">true</OmitResources>
     <GenFacadesIgnoreMissingTypes Condition="'$(TargetGroup)' == 'net461'">true</GenFacadesIgnoreMissingTypes>
-    <Configurations>net461-Windows_NT-Debug;net461-Windows_NT-Release;net462-Windows_NT-Debug;net462-Windows_NT-Release;net47-Windows_NT-Debug;net47-Windows_NT-Release;netcoreapp-Debug;netcoreapp-Release;netcoreapp-Windows_NT-Debug;netcoreapp-Windows_NT-Release;netfx-Windows_NT-Debug;netfx-Windows_NT-Release;netstandard-Debug;netstandard-Release;uap-Windows_NT-Debug;uap-Windows_NT-Release</Configurations>
+    <Configurations>net461-Windows_NT-Debug;net461-Windows_NT-Release;net462-Windows_NT-Debug;net462-Windows_NT-Release;net47-Windows_NT-Debug;net47-Windows_NT-Release;netcoreapp-Debug;netcoreapp-Release;netcoreapp-Windows_NT-Debug;netcoreapp-Windows_NT-Release;netfx-Windows_NT-Debug;netfx-Windows_NT-Release;netstandard-Debug;netstandard-Release;netstandard2.1-Debug;netstandard2.1-Release;uap-Windows_NT-Debug;uap-Windows_NT-Release</Configurations>
   </PropertyGroup>
   <PropertyGroup Condition="'$(TargetsWindows)' != 'true'">
     <GeneratePlatformNotSupportedAssemblyMessage>SR.PlatformNotSupported_CryptographyCng</GeneratePlatformNotSupportedAssemblyMessage>
     </Compile>
   </ItemGroup>
   <ItemGroup>
-    <None Include="@(AsnXml)" /> 
+    <None Include="@(AsnXml)" />
   </ItemGroup>
   <ItemGroup Condition="'$(IsPartialFacadeAssembly)' == 'true'">
     <Reference Include="mscorlib" />
     <Reference Include="System.Text.Encoding.Extensions" />
     <Reference Include="System.Threading" />
   </ItemGroup>
-</Project>
+</Project>
\ No newline at end of file
index acd9b5e..fc1c1fc 100644 (file)
@@ -2,6 +2,7 @@
   <PropertyGroup>
     <PackageConfigurations>
       netcoreapp;
+      netstandard2.1;
       net461;
     </PackageConfigurations>
     <BuildConfigurations>
index 1d8f8ec..92b6bff 100644 (file)
@@ -1,12 +1,12 @@
-<Project Sdk="Microsoft.NET.Sdk">
+<Project Sdk="Microsoft.NET.Sdk">
   <PropertyGroup>
     <ProjectGuid>{881269F5-9F22-4427-8DC5-63E2C05875BA}</ProjectGuid>
     <IsPartialFacadeAssembly Condition="'$(TargetsNetFx)' == 'true'">true</IsPartialFacadeAssembly>
-    <Configurations>net461-Debug;net461-Release;netcoreapp-Debug;netcoreapp-Release;netfx-Debug;netfx-Release;uap-Debug;uap-Release</Configurations>
+    <Configurations>net461-Debug;net461-Release;netcoreapp-Debug;netcoreapp-Release;netfx-Debug;netfx-Release;netstandard2.1-Debug;netstandard2.1-Release;uap-Debug;uap-Release</Configurations>
   </PropertyGroup>
   <ItemGroup>
     <Compile Include="System.Security.Cryptography.Pkcs.cs" />
-    <Compile Include="System.Security.Cryptography.Pkcs.netcoreapp.cs" Condition="'$(TargetGroup)' == 'netcoreapp' OR '$(TargetGroup)' == 'uap'" />
+    <Compile Include="System.Security.Cryptography.Pkcs.netcoreapp.cs" Condition="'$(TargetGroup)' == 'netcoreapp' OR '$(TargetGroup)' == 'uap' OR '$(TargetsNetStandard)' == 'true'" />
   </ItemGroup>
   <ItemGroup Condition="'$(TargetsNetFx)' == 'true'">
     <Reference Include="mscorlib" />
index 589f0c7..59a32d7 100644 (file)
@@ -3,6 +3,8 @@
     <PackageConfigurations>
       netstandard;
       netstandard-Windows_NT;
+      netstandard2.1;
+      netstandard2.1-Windows_NT;
       netcoreapp-Windows_NT;
       netcoreapp;
       net461-Windows_NT;
index a1e5968..8bfeeac 100644 (file)
@@ -189,7 +189,7 @@ namespace Internal.Cryptography.Pal.AnyOS
                 return null;
             }
 
-#if netcoreapp
+#if netcoreapp || netstandard21
             byte[] cek = null;
             int cekLength = 0;
 
index 41b511c..2f84574 100644 (file)
@@ -77,7 +77,7 @@ namespace Internal.Cryptography.Pal.AnyOS
                 return (T)(object)certificate.GetRSAPrivateKey();
             if (typeof(T) == typeof(ECDsa))
                 return (T)(object)certificate.GetECDsaPrivateKey();
-#if netcoreapp
+#if netcoreapp || netstandard21
             if (typeof(T) == typeof(DSA))
                 return (T)(object)certificate.GetDSAPrivateKey();
 #endif
index 346a2fd..e7d0ec9 100644 (file)
@@ -22,7 +22,7 @@ namespace Internal.Cryptography
     {
         private static readonly byte[] s_pSpecifiedDefaultParameters = { 0x04, 0x00 };
 
-#if !netcoreapp
+#if !netcoreapp && !netstandard21
         // Compatibility API.
         internal static void AppendData(this IncrementalHash hasher, ReadOnlySpan<byte> data)
         {
@@ -319,7 +319,7 @@ namespace Internal.Cryptography
             return ToUpperHexString(serialBytes);
         }
 
-#if netcoreapp
+#if netcoreapp || netstandard21
         private static unsafe string ToUpperHexString(ReadOnlySpan<byte> ba)
         {
             fixed (byte* baPtr = ba)
@@ -411,7 +411,7 @@ namespace Internal.Cryptography
                     attributeObject = Upgrade<Pkcs9MessageDigest>(attributeObject);
                     break;
 
-#if netcoreapp
+#if netcoreapp || netstandard21
                 case Oids.LocalKeyId:
                     attributeObject = Upgrade<Pkcs9LocalKeyId>(attributeObject);
                     break;
index d045a33..2938b9a 100644 (file)
@@ -1,4 +1,4 @@
-<Project Sdk="Microsoft.NET.Sdk">
+<Project Sdk="Microsoft.NET.Sdk">
   <PropertyGroup>
     <ProjectGuid>{03D84CBD-896D-4B2F-9A22-07034F51E73D}</ProjectGuid>
     <AssemblyName>System.Security.Cryptography.Pkcs</AssemblyName>
@@ -8,7 +8,7 @@
     <UsePackageTargetRuntimeDefaults Condition="'$(IsPartialFacadeAssembly)' != 'true'">true</UsePackageTargetRuntimeDefaults>
     <IncludeDllSafeSearchPathAttribute>true</IncludeDllSafeSearchPathAttribute>
     <NoWarn>$(NoWarn);CS1574;CS3016</NoWarn>
-    <Configurations>net461-Windows_NT-Debug;net461-Windows_NT-Release;netcoreapp-Debug;netcoreapp-Release;netcoreapp-Windows_NT-Debug;netcoreapp-Windows_NT-Release;netfx-Windows_NT-Debug;netfx-Windows_NT-Release;netstandard-Debug;netstandard-Release;netstandard-Windows_NT-Debug;netstandard-Windows_NT-Release</Configurations>
+    <Configurations>net461-Windows_NT-Debug;net461-Windows_NT-Release;netcoreapp-Debug;netcoreapp-Release;netcoreapp-Windows_NT-Debug;netcoreapp-Windows_NT-Release;netfx-Windows_NT-Debug;netfx-Windows_NT-Release;netstandard-Debug;netstandard-Release;netstandard-Windows_NT-Debug;netstandard-Windows_NT-Release;netstandard2.1-Debug;netstandard2.1-Release;netstandard2.1-Windows_NT-Debug;netstandard2.1-Windows_NT-Release</Configurations>
   </PropertyGroup>
   <Import Project="$(CommonPath)\System\Security\Cryptography\Asn1\AsnXml.targets" Condition="'$(IsPartialFacadeAssembly)' != 'true'" />
   <Import Project="$(CommonPath)\System\Security\Cryptography\Asn1Reader\System.Security.Cryptography.Asn1Reader.Shared.projitems" Condition="'$(IsPartialFacadeAssembly)' != 'true'" />
     <Reference Include="mscorlib" />
     <Reference Include="System.Security" />
   </ItemGroup>
-  <ItemGroup Condition="'$(TargetGroup)' == 'netcoreapp'">
+  <ItemGroup Condition="'$(TargetGroup)' == 'netcoreapp' OR '$(TargetGroup)' == 'netstandard2.1'">
     <Reference Include="System.Runtime" />
     <Reference Include="System.Runtime.Numerics" />
     <Reference Include="System.Collections" />
     <Reference Include="System.Linq" />
     <Reference Include="System.Text.Encoding.Extensions" />
   </ItemGroup>
-  <ItemGroup Condition="'$(IsPartialFacadeAssembly)' != 'true'">
+  <ItemGroup Condition="'$(IsPartialFacadeAssembly)' != 'true' AND '$(TargetGroup)' != 'netstandard2.1'">
     <Reference Include="System.Buffers" />
+  </ItemGroup>
+  <ItemGroup Condition="'$(IsPartialFacadeAssembly)' != 'true'">
     <Reference Include="System.Memory" />
     <Reference Include="System.Security.Cryptography.Cng" />
   </ItemGroup>
     <Compile Include="System\Security\Cryptography\Pkcs\SignerInfoCollection.cs" />
     <Compile Include="System\Security\Cryptography\Pkcs\SignerInfoEnumerator.cs" />
   </ItemGroup>
-  <ItemGroup Condition="'$(TargetGroup)' == 'netcoreapp'">
+  <ItemGroup Condition="'$(TargetGroup)' == 'netcoreapp' OR '$(TargetGroup)' == 'netstandard2.1'">
     <Compile Include="$(CommonPath)\System\Security\Cryptography\KeyFormatHelper.cs">
       <Link>Common\System\Security\Cryptography\KeyFormatHelper.cs</Link>
     </Compile>
index 62cf6bd..0bde61f 100644 (file)
@@ -37,7 +37,7 @@ namespace System.Security.Cryptography.Pkcs
             }
 
             internal override bool VerifySignature(
-#if netcoreapp
+#if netcoreapp || netstandard21
                 ReadOnlySpan<byte> valueHash,
                 ReadOnlyMemory<byte> signature,
 #else
@@ -68,7 +68,7 @@ namespace System.Security.Cryptography.Pkcs
                 DSAParameters dsaParameters = dsa.ExportParameters(false);
                 int bufSize = 2 * dsaParameters.Q.Length;
 
-#if netcoreapp
+#if netcoreapp || netstandard21
                 byte[] rented = CryptoPool.Rent(bufSize);
                 Span<byte> ieee = new Span<byte>(rented, 0, bufSize);
 
@@ -83,7 +83,7 @@ namespace System.Security.Cryptography.Pkcs
                     }
 
                     return dsa.VerifySignature(valueHash, ieee);
-#if netcoreapp
+#if netcoreapp || netstandard21
                 }
                 finally
                 {
@@ -93,7 +93,7 @@ namespace System.Security.Cryptography.Pkcs
             }
 
             protected override bool Sign(
-#if netcoreapp
+#if netcoreapp || netstandard21
                 ReadOnlySpan<byte> dataHash,
 #else
                 byte[] dataHash,
@@ -133,7 +133,7 @@ namespace System.Security.Cryptography.Pkcs
 
                 signatureAlgorithm = new Oid(oidValue, oidValue);
 
-#if netcoreapp
+#if netcoreapp || netstandard21
                 // The Q size cannot be bigger than the KeySize.
                 byte[] rented = CryptoPool.Rent(dsa.KeySize / 8);
                 int bytesWritten = 0;
index 827e101..21c47d0 100644 (file)
@@ -37,7 +37,7 @@ namespace System.Security.Cryptography.Pkcs
             }
 
             internal override bool VerifySignature(
-#if netcoreapp
+#if netcoreapp || netstandard21
                 ReadOnlySpan<byte> valueHash,
                 ReadOnlyMemory<byte> signature,
 #else
@@ -73,7 +73,7 @@ namespace System.Security.Cryptography.Pkcs
                     bufSize = 2 * fieldSize;
                 }
 
-#if netcoreapp
+#if netcoreapp || netstandard21
                 byte[] rented = CryptoPool.Rent(bufSize);
                 Span<byte> ieee = new Span<byte>(rented, 0, bufSize);
 
@@ -88,7 +88,7 @@ namespace System.Security.Cryptography.Pkcs
                     }
 
                     return key.VerifyHash(valueHash, ieee);
-#if netcoreapp
+#if netcoreapp || netstandard21
                 }
                 finally
                 {
@@ -98,7 +98,7 @@ namespace System.Security.Cryptography.Pkcs
             }
 
             protected override bool Sign(
-#if netcoreapp
+#if netcoreapp || netstandard21
                 ReadOnlySpan<byte> dataHash,
 #else
                 byte[] dataHash,
@@ -138,7 +138,7 @@ namespace System.Security.Cryptography.Pkcs
 
                 signatureAlgorithm = new Oid(oidValue, oidValue);
 
-#if netcoreapp
+#if netcoreapp || netstandard21
                 int bufSize;
                 checked
                 {
@@ -174,7 +174,7 @@ namespace System.Security.Cryptography.Pkcs
 #endif
 
                 signatureValue = DsaIeeeToDer(key.SignHash(
-#if netcoreapp
+#if netcoreapp || netstandard21
                     dataHash.ToArray()
 #else
                     dataHash
index bd3b26c..61a802d 100644 (file)
@@ -40,7 +40,7 @@ namespace System.Security.Cryptography.Pkcs
             }
 
             internal override bool VerifySignature(
-#if netcoreapp
+#if netcoreapp || netstandard21
                 ReadOnlySpan<byte> valueHash,
                 ReadOnlyMemory<byte> signature,
 #else
@@ -76,7 +76,7 @@ namespace System.Security.Cryptography.Pkcs
 
                 return publicKey.VerifyHash(
                     valueHash,
-#if netcoreapp
+#if netcoreapp || netstandard21
                     signature.Span,
 #else
                     signature,
@@ -123,7 +123,7 @@ namespace System.Security.Cryptography.Pkcs
             }
 
             protected override bool Sign(
-#if netcoreapp
+#if netcoreapp || netstandard21
                 ReadOnlySpan<byte> dataHash,
 #else
                 byte[] dataHash,
@@ -151,7 +151,7 @@ namespace System.Security.Cryptography.Pkcs
 
                 signatureAlgorithm = new Oid(Oids.Rsa, Oids.Rsa);
 
-#if netcoreapp
+#if netcoreapp || netstandard21
                 byte[] signature = new byte[privateKey.KeySize / 8];
 
                 bool signed = privateKey.TrySignHash(
@@ -176,7 +176,7 @@ namespace System.Security.Cryptography.Pkcs
                 }
 #endif
                 signatureValue = privateKey.SignHash(
-#if netcoreapp
+#if netcoreapp || netstandard21
                     dataHash.ToArray(),
 #else
                     dataHash,
@@ -267,7 +267,7 @@ namespace System.Security.Cryptography.Pkcs
             }
 
             protected override bool Sign(
-#if netcoreapp
+#if netcoreapp || netstandard21
                 ReadOnlySpan<byte> dataHash,
 #else
                 byte[] dataHash,
index d5fd6a6..a82239f 100644 (file)
@@ -29,7 +29,7 @@ namespace System.Security.Cryptography.Pkcs
         protected abstract bool VerifyKeyType(AsymmetricAlgorithm key);
 
         internal abstract bool VerifySignature(
-#if netcoreapp
+#if netcoreapp || netstandard21
             ReadOnlySpan<byte> valueHash,
             ReadOnlyMemory<byte> signature,
 #else
@@ -42,7 +42,7 @@ namespace System.Security.Cryptography.Pkcs
             X509Certificate2 certificate);
 
         protected abstract bool Sign(
-#if netcoreapp
+#if netcoreapp || netstandard21
             ReadOnlySpan<byte> dataHash,
 #else
             byte[] dataHash,
@@ -70,7 +70,7 @@ namespace System.Security.Cryptography.Pkcs
         }
 
         internal static bool Sign(
-#if netcoreapp
+#if netcoreapp || netstandard21
             ReadOnlySpan<byte> dataHash,
 #else
             byte[] dataHash,
@@ -167,7 +167,7 @@ namespace System.Security.Cryptography.Pkcs
             {
                 writer.PushSequence();
 
-#if netcoreapp
+#if netcoreapp || netstandard21
                 // r
                 BigInteger val = new BigInteger(
                     ieeeSignature.Slice(0, fieldSize),
index b12b82f..e5eb555 100644 (file)
@@ -594,7 +594,7 @@ namespace System.Security.Cryptography.Pkcs
                     {
                         writer.PopSequence();
 
-#if netcoreapp
+#if netcoreapp || netstandard21
                         Span<byte> setOfTag = stackalloc byte[1];
                         setOfTag[0] = 0x31;
 
@@ -610,7 +610,7 @@ namespace System.Security.Cryptography.Pkcs
                     {
                         writer.PopSetOf();
 
-#if netcoreapp
+#if netcoreapp || netstandard21
                         hasher.AppendData(writer.EncodeAsSpan());
 #else
                         hasher.AppendData(writer.Encode());
@@ -703,7 +703,7 @@ namespace System.Security.Cryptography.Pkcs
                     return false;
                 }
 
-#if netcoreapp
+#if netcoreapp || netstandard21
                 // SHA-2-512 is the biggest digest type we know about.
                 Span<byte> digestValue = stackalloc byte[512 / 8];
                 ReadOnlySpan<byte> digest = digestValue;
index 55aeef0..0a497a0 100644 (file)
@@ -2,7 +2,7 @@
   <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Directory.Build.props))\Directory.Build.props" />
 
   <PropertyGroup>
-    <AdditionalBuildConfigurations>$(AdditionalBuildConfigurations);netstandard-$(OSGroup)-$(ConfigurationGroup)-$(ArchGroup)</AdditionalBuildConfigurations>
+    <AdditionalBuildConfigurations>$(AdditionalBuildConfigurations);netstandard-$(OSGroup)-$(ConfigurationGroup)-$(ArchGroup);netstandard2.1-$(OSGroup)-$(ConfigurationGroup)</AdditionalBuildConfigurations>
   </PropertyGroup>
 
   <ItemGroup>
@@ -10,4 +10,4 @@
   </ItemGroup>
 
   <Import Project="$(RepositoryEngineeringDir)dir.traversal.targets" />
-</Project>
\ No newline at end of file
+</Project>