예제 #1
0
        public void ValidatorShouldReturnFalseWhenSslPolicyErrorsIsRemoteCertificateNotAvailable()
        {
            var  instance = new CertificateThumbprintValidator(new string[1]);
            bool result   = instance.Validate(null, null, null, SslPolicyErrors.RemoteCertificateNotAvailable);

            result.ShouldBe(false);
        }
        public void ValidatorShouldReturnFalseWhenPassedATrustedCertificateWhichDoesNotHaveAWhitelistedThumbprint()
        {
            var instance = new CertificateThumbprintValidator(new string[1]);
            var certificateChain = new X509Chain();
            certificateChain.Build(Chained);
            certificateChain.ChainPolicy.RevocationMode = X509RevocationMode.NoCheck;

            bool result = instance.Validate(null, Chained, certificateChain, SslPolicyErrors.None);

            result.ShouldBe(false);
        }
예제 #3
0
        public void ValidatorShouldReturnFalseWhenPassedATrustedCertificateWhichDoesNotHaveAWhitelistedThumbprint()
        {
            var instance         = new CertificateThumbprintValidator(new string[1]);
            var certificateChain = new X509Chain();

            certificateChain.Build(Chained);
            certificateChain.ChainPolicy.RevocationMode = X509RevocationMode.NoCheck;

            bool result = instance.Validate(null, Chained, certificateChain, SslPolicyErrors.None);

            result.ShouldBe(false);
        }
예제 #4
0
        public void ValidatorShouldReturnTrueWhenPassedATrustedCertificateWhichHasAChainElementThumbprintWhiteListed()
        {
            var instance         = new CertificateThumbprintValidator(new[] { MicrosoftInternetAuthorityThumbprint });
            var certificateChain = new X509Chain();

            certificateChain.Build(Chained);
            certificateChain.ChainPolicy.RevocationMode = X509RevocationMode.NoCheck;

            bool result = instance.Validate(null, Chained, certificateChain, SslPolicyErrors.None);

            result.ShouldBe(true);
        }
        public void ValidatorShouldReturnTrueWhenPassedATrustedCertificateWhichHasItsThumbprintWhiteListed()
        {
            var instance = new CertificateThumbprintValidator(new[] { KatanaTestThumbprint });
            var certificateChain = new X509Chain();
            certificateChain.Build(Chained);
            certificateChain.ChainPolicy.RevocationMode = X509RevocationMode.NoCheck;

            bool result = instance.Validate(null, Chained, certificateChain, SslPolicyErrors.None);

            result.ShouldBe(true);
        }
 public void ValidatorShouldReturnFalseWhenSslPolicyErrorsIsRemoteCertificateNotAvailable()
 {
     var instance = new CertificateThumbprintValidator(new string[1]);
     bool result = instance.Validate(null, null, null, SslPolicyErrors.RemoteCertificateNotAvailable);
     result.ShouldBe(false);
 }
        public void ConstructorShouldNotThrowWithValidValues()
        {
            var instance = new CertificateThumbprintValidator(new string[1]);

            instance.ShouldNotBe(null);
        }
예제 #8
0
        public void ConstructorShouldNotThrowWithValidValues()
        {
            var instance = new CertificateThumbprintValidator(new string[1]);

            instance.ShouldNotBe(null);
        }