本文整理汇总了C#中Seed.CreateCertificate方法的典型用法代码示例。如果您正苦于以下问题:C# Seed.CreateCertificate方法的具体用法?C# Seed.CreateCertificate怎么用?C# Seed.CreateCertificate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Seed
的用法示例。
在下文中一共展示了Seed.CreateCertificate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Test_AmoebaConverter_Seed
public void Test_AmoebaConverter_Seed()
{
var seed = new Seed();
seed.Name = "aaaa.zip";
seed.Keywords.AddRange(new KeywordCollection
{
"bbbb",
"cccc",
"dddd",
});
seed.CreationTime = DateTime.Now;
seed.Length = 10000;
seed.Comment = "eeee";
seed.Rank = 1;
seed.Key = new Key(new byte[32], HashAlgorithm.Sha256);
seed.CompressionAlgorithm = CompressionAlgorithm.Xz;
seed.CryptoAlgorithm = CryptoAlgorithm.Aes256;
seed.CryptoKey = new byte[32 + 32];
DigitalSignature digitalSignature = new DigitalSignature("123", DigitalSignatureAlgorithm.Rsa2048_Sha256);
seed.CreateCertificate(digitalSignature);
var stringSeed = AmoebaConverter.ToSeedString(seed);
var seed2 = AmoebaConverter.FromSeedString(stringSeed);
Assert.AreEqual(seed, seed2, "AmoebaConverter #2");
}
示例2: Test_Seed
public void Test_Seed()
{
foreach (var a in new DigitalSignatureAlgorithm[] { DigitalSignatureAlgorithm.Rsa2048_Sha256, DigitalSignatureAlgorithm.EcDsaP521_Sha256 })
{
var seed = new Seed();
seed.Name = "aaaa.zip";
seed.Keywords.AddRange(new KeywordCollection
{
"bbbb",
"cccc",
"dddd",
});
seed.CreationTime = DateTime.Now;
seed.Length = 10000;
seed.Comment = "eeee";
seed.Rank = 1;
seed.Key = new Key(new byte[32], HashAlgorithm.Sha256);
seed.CompressionAlgorithm = CompressionAlgorithm.Xz;
seed.CryptoAlgorithm = CryptoAlgorithm.Aes256;
seed.CryptoKey = new byte[32 + 32];
DigitalSignature digitalSignature = new DigitalSignature("123", a);
seed.CreateCertificate(digitalSignature);
var seed2 = seed.Clone();
Assert.AreEqual(seed, seed2, "Seed #1");
Seed seed3;
using (var seedStream = seed.Export(_bufferManager))
{
seed3 = Seed.Import(seedStream, _bufferManager);
}
Assert.AreEqual(seed, seed3, "Seed #2");
Assert.IsTrue(seed3.VerifyCertificate(), "Seed #3");
}
}