本文整理汇总了C#中DerInteger.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# DerInteger.Equals方法的具体用法?C# DerInteger.Equals怎么用?C# DerInteger.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DerInteger
的用法示例。
在下文中一共展示了DerInteger.Equals方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PerformTest
public override void PerformTest()
{
DerInteger val = new DerInteger(9);
DerApplicationSpecific tagged = new DerApplicationSpecific(false, 3, val);
if (!AreEqual(impData, tagged.GetEncoded()))
{
Fail("implicit encoding failed");
}
DerInteger recVal = (DerInteger) tagged.GetObject(Asn1Tags.Integer);
if (!val.Equals(recVal))
{
Fail("implicit read back failed");
}
DerApplicationSpecific certObj = (DerApplicationSpecific)
Asn1Object.FromByteArray(certData);
if (!certObj.IsConstructed() || certObj.ApplicationTag != 33)
{
Fail("parsing of certificate data failed");
}
byte[] encoded = certObj.GetDerEncoded();
if (!Arrays.AreEqual(certData, encoded))
{
Console.WriteLine(Encoding.ASCII.GetString(certData, 0, certData.Length).Substring(0, 20));
Console.WriteLine(Encoding.ASCII.GetString(encoded, 0, encoded.Length).Substring(0, 20));
Fail("re-encoding of certificate data failed");
}
}
示例2: PerformTest
public override void PerformTest()
{
TestTaggedObject();
DerApplicationSpecific appSpec = (DerApplicationSpecific)Asn1Object.FromByteArray(sampleData);
if (1 != appSpec.ApplicationTag)
{
Fail("wrong tag detected");
}
DerInteger val = new DerInteger(9);
DerApplicationSpecific tagged = new DerApplicationSpecific(false, 3, val);
if (!AreEqual(impData, tagged.GetEncoded()))
{
Fail("implicit encoding failed");
}
DerInteger recVal = (DerInteger) tagged.GetObject(Asn1Tags.Integer);
if (!val.Equals(recVal))
{
Fail("implicit read back failed");
}
DerApplicationSpecific certObj = (DerApplicationSpecific)
Asn1Object.FromByteArray(certData);
if (!certObj.IsConstructed() || certObj.ApplicationTag != 33)
{
Fail("parsing of certificate data failed");
}
byte[] encoded = certObj.GetDerEncoded();
if (!Arrays.AreEqual(certData, encoded))
{
Fail("re-encoding of certificate data failed");
}
}