Skip to content

Commit

Permalink
Reflection.Metadata.Tests: make tests pass when rsa+sha1 signing is n…
Browse files Browse the repository at this point in the history
…ot supported.
  • Loading branch information
tmds committed Jun 30, 2022
1 parent 3f041eb commit 85223ce
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public void BasicValidation(Machine machine)
}
}

[Fact]
[ConditionalFact(typeof(SigningUtilities), nameof(SigningUtilities.SupportsSigning))]
[SkipOnPlatform(TestPlatforms.Browser, "System.Security.Cryptography isn't supported on browser")]
public void BasicValidationSigned()
{
Expand Down Expand Up @@ -748,7 +748,7 @@ private static IEnumerable<string> GetBlobRanges(BlobBuilder builder, IEnumerabl
}
}

[Fact]
[ConditionalFact(typeof(SigningUtilities), nameof(SigningUtilities.SupportsSigning))]
[SkipOnPlatform(TestPlatforms.Browser, "System.Security.Cryptography isn't supported on browser")]
public void Checksum()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
<EnableLibraryImportGenerator>true</EnableLibraryImportGenerator>
</PropertyGroup>
<ItemGroup>
<Compile Include="$(CommonTestPath)System\Security\Cryptography\SignatureSupport.cs"
Link="CommonTest\System\Security\Cryptography\SignatureSupport.cs" />
<Compile Include="$(CommonPath)Interop\Windows\Interop.Libraries.cs"
Link="Common\Interop\Windows\Interop.Libraries.cs" />
<Compile Include="$(CommonPath)Interop\Windows\Kernel32\Interop.FreeLibrary.cs"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ namespace System.Reflection.PortableExecutable.Tests
{
internal static class SigningUtilities
{
public static bool SupportsSigning { get; } =
System.Security.Cryptography.Tests.SignatureSupport.CanProduceSha1Signature(RSA.Create());

public static byte[] CalculateRsaSignature(IEnumerable<Blob> content, byte[] privateKey)
{
var hash = CalculateSha1(content);
Expand Down

0 comments on commit 85223ce

Please sign in to comment.