Also added tests for both ECDsaCng and ECDiffieHellmanCng to ensure the default matches .NET Framework.
Commit migrated from https://github.com/dotnet/corefx/commit/
d60303de08c9c9c4b2138f02ad597f6486648c11
public sealed partial class ECDsaCng : ECDsa
{
private CngAlgorithmCore _core;
- private CngAlgorithm _hashAlgorithm;
+ private CngAlgorithm _hashAlgorithm = CngAlgorithm.Sha256;
/// <summary>
/// Hash algorithm to use when generating a signature over arbitrary data
Assert.Equal(outputCng, outputAlgorithms);
}
}
+
+ [Fact]
+ public static void HashAlgorithm_DefaultsToSha256()
+ {
+ using (var ecdhCng = new ECDiffieHellmanCng())
+ Assert.Equal(CngAlgorithm.Sha256, ecdhCng.HashAlgorithm);
+ }
}
}
}
}
+ [Fact]
+ public static void HashAlgorithm_DefaultsToSha256()
+ {
+ using (var cng = new ECDsaCng())
+ Assert.Equal(CngAlgorithm.Sha256, cng.HashAlgorithm);
+ }
+
#if netcoreapp
[Fact]
public static void TestPositive256WithBlob()