public void ValidatorShouldReturnFalseWhenSslPolicyErrorsIsRemoteCertificateNotAvailable() { var instance = new CertificateSubjectKeyIdentifierValidator(new[] { string.Empty }); bool result = instance.Validate(null, null, null, SslPolicyErrors.RemoteCertificateNotAvailable); result.ShouldBe(false); }
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); }
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); }
public void ConstructorShouldNotThrowWithValidValues() { var instance = new CertificateSubjectKeyIdentifierValidator(new[] { string.Empty }); instance.ShouldNotBe(null); }