Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Failing Crypto Tests #9

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>
Loading