Skip to content

Commit

Permalink
work around bouncy castle interface compatibility break
Browse files Browse the repository at this point in the history
  • Loading branch information
Xor-el committed May 3, 2024
1 parent 886a068 commit c742b7f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
13 changes: 7 additions & 6 deletions tests/Hydrogen.CryptoEx.Tests/ECDSATests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,13 @@ private static byte[] R_And_S_To_DerSig(BigInteger[] rs) {
throw new ArgumentException(InvalidRAndSSignature, nameof(rs));
}

var outStream = new MemoryStream();
var generator = new DerSequenceGenerator(outStream);
generator.AddObject(new DerInteger(rs[0]));
generator.AddObject(new DerInteger(rs[1]));
//generator.Close();
return outStream.ToArray();
using (var outputStream = new MemoryStream()) {
using (var sequenceGenerator = new DerSequenceGenerator(outputStream)) {
sequenceGenerator.AddObject(new DerInteger(rs[0]));
sequenceGenerator.AddObject(new DerInteger(rs[1]));
}
return outputStream.ToArray();
}
}

public static byte[] CanonicalizeSig(BigInteger order, byte[] sig) {
Expand Down
9 changes: 9 additions & 0 deletions tests/Hydrogen.CryptoEx.Tests/Hydrogen.CryptoEx.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,13 @@
</EmbeddedResource>
</ItemGroup>

<!-- In current version of BouncyCastle.Cryptography there is a problem with finding interfaces implementations.
See here https://github.com/bcgit/bc-csharp/issues/447 for more details. -->
<ItemGroup>
<PackageReference Include="BouncyCastle.Cryptography" Version="2.3.0" ExcludeAssets="Compile" GeneratePathProperty="true" />
<Reference Include="BouncyCastle.Cryptography">
<HintPath>$(PkgBouncyCastle_Cryptography)\lib\netstandard2.0\BouncyCastle.Cryptography.dll</HintPath>
</Reference>
</ItemGroup>

</Project>

0 comments on commit c742b7f

Please sign in to comment.