Ejemplo n.º 1
0
        public void VerifyCertificate()
        {
            // create certificates
            var caCertificate   = CertificateProvider.GenerateCertificateAuthorityCertificate("Certificate Authority - Graham Miller");
            var leafCertificate = CertificateProvider.GenerateSignedCertificate("Graham Miller", caCertificate);

            Assert.That(caCertificate.Verify(), Is.False);
            Assert.That(leafCertificate.Verify(), Is.False);
            Assert.That(Verify(leafCertificate), Is.False);

            AddCertificateToStore(caCertificate);
            Assert.That(caCertificate.Verify(), Is.True);
            Assert.That(leafCertificate.Verify(), Is.False);
            Assert.That(Verify(leafCertificate), Is.True);

            RemoveCertificateFromStore(caCertificate);
            Assert.That(caCertificate.Verify(), Is.False);
            Assert.That(leafCertificate.Verify(), Is.False);
            Assert.That(Verify(leafCertificate), Is.False);
        }