Example #1
0
            public void KeySize2048CertificateCorrectlyParses()
            {
                var options = new RSACertificateBuilderOptions
                {
                    FullSubjectName = "CN=Test",
                    KeySize         = 2048
                };

                var cert = RSACertificateBuilder.CreateNewCertificate(options);
                var cng  = RSACertificateParser.ParsePublicCertificate(cert);

                Assert.IsNotNull(cng);
            }
        public void CreateWithSha512Hash()
        {
            var options = new RSACertificateBuilderOptions
            {
                FullSubjectName = "CN=Test",
                HashingMethod   = HashingMethods.Sha512
            };

            var cert = RSACertificateBuilder.CreateNewCertificate(options);

            Assert.AreEqual("CN=Test", cert.Subject);
            Assert.AreEqual("sha512RSA", cert.SignatureAlgorithm.FriendlyName);
            Assert.IsTrue(cert.HasPrivateKey);
        }
        public void CreateWith7168KeySize()
        {
            var options = new RSACertificateBuilderOptions
            {
                FullSubjectName = "CN=Test",
                KeySize         = 7168
            };

            var cert = RSACertificateBuilder.CreateNewCertificate(options);

            Assert.AreEqual("CN=Test", cert.Subject);
            Assert.AreEqual("sha256RSA", cert.SignatureAlgorithm.FriendlyName);
            Assert.IsTrue(cert.HasPrivateKey);
        }