本文整理汇总了C#中BigNumber.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# BigNumber.Dispose方法的具体用法?C# BigNumber.Dispose怎么用?C# BigNumber.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BigNumber
的用法示例。
在下文中一共展示了BigNumber.Dispose方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: test_ecdh_curve
private void test_ecdh_curve(Asn1Object obj, string text, BigNumber.Context ctx) {
Key a = Key.FromCurveName(obj);
Key b = Key.FromCurveName(obj);
BigNumber x_a = new BigNumber();
BigNumber y_a = new BigNumber();
BigNumber x_b = new BigNumber();
BigNumber y_b = new BigNumber();
try {
Console.Write("Testing key generation with {0}", text);
a.GenerateKey();
if (a.Group.Method.FieldType == Objects.NID.X9_62_prime_field.NID) {
a.PublicKey.GetAffineCoordinatesGFp(x_a, y_a, ctx);
}
else {
a.PublicKey.GetAffineCoordinatesGF2m(x_a, y_a, ctx);
}
Console.Write(".");
b.GenerateKey();
if (b.Group.Method.FieldType == Objects.NID.X9_62_prime_field.NID) {
b.PublicKey.GetAffineCoordinatesGFp(x_b, y_b, ctx);
}
else {
b.PublicKey.GetAffineCoordinatesGF2m(x_b, y_b, ctx);
}
Console.Write(".");
byte[] abuf = new byte[MessageDigest.SHA1.Size];
int aout = a.ComputeKey(b, abuf, KDF1_SHA1);
Console.Write(".");
byte[] bbuf = new byte[MessageDigest.SHA1.Size];
int bout = b.ComputeKey(a, bbuf, KDF1_SHA1);
Console.Write(".");
Assert.Greater(aout, 4);
Assert.AreEqual(aout, bout);
Assert.IsTrue(Compare(abuf, bbuf));
Console.Write(" ok");
}
finally {
a.Dispose();
b.Dispose();
x_a.Dispose();
y_a.Dispose();
x_b.Dispose();
y_b.Dispose();
}
Console.WriteLine();
}