当前位置: 首页>>代码示例>>C#>>正文


C# Seed.CreateCertificate方法代码示例

本文整理汇总了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");
        }
开发者ID:networkelements,项目名称:Library,代码行数:27,代码来源:Test_Library_Net_Amoeba.cs

示例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");
            }
        }
开发者ID:networkelements,项目名称:Library,代码行数:39,代码来源:Test_Library_Net_Amoeba.cs


注:本文中的Seed.CreateCertificate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。