Ejemplo n.º 1
0
        public void ShouldTrustIfHostnameDiffers()
        {
            var pkcs12 = X509TestUtils.CreateCert("localhost", DateTime.Now.AddYears(-1), DateTime.Now.AddYears(1),
                                                  null, null, null);
            var cert         = X509TestUtils.ToDotnetCertificate(pkcs12);
            var trustManager = new InsecureTrustManager(false);

            var result = new TrustManagerHandshaker(new Uri("bolt://localhost2"), cert, trustManager).Perform();

            result.Should().BeTrue();
        }
Ejemplo n.º 2
0
        public void ShouldNotTrustIfNotTrusted()
        {
            var pkcs12 = X509TestUtils.CreateCert("localhost", DateTime.Now.AddYears(-1), DateTime.Now.AddYears(1),
                                                  null, null, null);
            var cert         = X509TestUtils.ToDotnetCertificate(pkcs12);
            var trustManager = new CertificateTrustManager(true, new X509Certificate2[] {});

            var result = new TrustManagerHandshaker(new Uri("bolt://localhost"), cert, trustManager).Perform();

            result.Should().BeFalse();
        }