本文整理汇总了C#中Box.CreateCertificate方法的典型用法代码示例。如果您正苦于以下问题:C# Box.CreateCertificate方法的具体用法?C# Box.CreateCertificate怎么用?C# Box.CreateCertificate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Box
的用法示例。
在下文中一共展示了Box.CreateCertificate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Test_AmoebaConverter_Box
public void Test_AmoebaConverter_Box()
{
var box = new Box();
box.Name = "Box";
box.Comment = "Comment";
box.CreationTime = DateTime.Now;
box.Boxes.Add(new Box() { Name = "Box" });
box.Seeds.Add(new Seed() { Name = "Seed" });
DigitalSignature digitalSignature = new DigitalSignature("123", DigitalSignatureAlgorithm.EcDsaP521_Sha256);
box.CreateCertificate(digitalSignature);
Box box2;
using (var streamBox = AmoebaConverter.ToBoxStream(box))
{
box2 = AmoebaConverter.FromBoxStream(streamBox);
}
Assert.AreEqual(box, box2, "AmoebaConverter #3");
}
示例2: Test_Box
public void Test_Box()
{
var box = new Box();
box.Name = "Box";
box.Comment = "Comment";
box.CreationTime = DateTime.Now;
box.Seeds.Add(new Seed() { Name = "Seed" });
box.Boxes.Add(new Box() { Name = "Box" });
DigitalSignature digitalSignature = new DigitalSignature("123", DigitalSignatureAlgorithm.EcDsaP521_Sha256);
box.CreateCertificate(digitalSignature);
var box2 = box.Clone();
Assert.AreEqual(box, box2, "Box #1");
Box box3;
using (var boxStream = box.Export(_bufferManager))
{
box3 = Box.Import(boxStream, _bufferManager);
}
Assert.AreEqual(box, box3, "Box #2");
Assert.IsTrue(box3.VerifyCertificate(), "Box #3");
{
var parentBox = new Box();
var childBox = parentBox;
for (int i = 0; i < 256; i++)
{
var tempBox = new Box();
childBox.Boxes.Add(tempBox);
childBox = tempBox;
}
using (var binaryBox = parentBox.Export(_bufferManager))
{
}
}
{
var parentBox = new Box();
var childBox = parentBox;
for (int i = 0; i < 256 + 1; i++)
{
var tempBox = new Box();
childBox.Boxes.Add(tempBox);
childBox = tempBox;
}
Assert.Throws<ArgumentException>(() =>
{
using (var binaryBox = parentBox.Export(_bufferManager))
{
}
});
}
{
var parentBox = new T_Box();
var childBox = parentBox;
for (int i = 0; i < 256; i++)
{
var tempBox = new T_Box();
childBox.D_Boxes.Add(tempBox);
childBox = tempBox;
}
using (var binaryBox = parentBox.Export(_bufferManager))
{
Box.Import(binaryBox, _bufferManager);
}
}
{
var parentBox = new T_Box();
var childBox = parentBox;
for (int i = 0; i < 256 + 1; i++)
{
var tempBox = new T_Box();
childBox.D_Boxes.Add(tempBox);
childBox = tempBox;
}
Assert.Throws<ArgumentException>(() =>
{
using (var binaryBox = parentBox.Export(_bufferManager))
{
Box.Import(binaryBox, _bufferManager);
}
});
}
}