Beispiel #1
0
        public void ValidatorShouldReturnFalseWhenSslPolicyErrorsIsRemoteCertificateNotAvailable()
        {
            var  instance = new CertificateSubjectKeyIdentifierValidator(new[] { string.Empty });
            bool result   = instance.Validate(null, null, null, SslPolicyErrors.RemoteCertificateNotAvailable);

            result.ShouldBe(false);
        }
Beispiel #2
0
        public void ValidatorShouldReturnFalseWhenPassedATrustedCertificateWhichDoesNotHaveAWhitelistedSubjectKeyIdentifier()
        {
            var instance         = new CertificateSubjectKeyIdentifierValidator(new[] { string.Empty });
            var certificateChain = new X509Chain();

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

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

            result.ShouldBe(false);
        }
Beispiel #3
0
        public void ValidatorShouldReturnTrueWhenPassedATrustedCertificateWhichHasAChainElementSubjectKeyIdentifierWhiteListed()
        {
            var instance = new CertificateSubjectKeyIdentifierValidator(
                new[]
            {
                MicrosoftInternetAuthorityKeyIdentifier
            });
            var certificateChain = new X509Chain();

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

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

            result.ShouldBe(true);
        }
Beispiel #4
0
        public void ConstructorShouldNotThrowWithValidValues()
        {
            var instance = new CertificateSubjectKeyIdentifierValidator(new[] { string.Empty });

            instance.ShouldNotBe(null);
        }