Ejemplo n.º 1
0
        public async Task HttpClient_ClientUsesAuxRecord_Ok()
        {
            X509Certificate2 serverCert = Configuration.Certificates.GetServerCertificate();

            var server = new SchSendAuxRecordTestServer(serverCert);
            int port = server.StartServer();

            string requestString = "https://localhost:" + port.ToString();
            
            using (var handler = new HttpClientHandler() { ServerCertificateCustomValidationCallback = LoopbackServer.AllowAllCertificates })
            using (var client = new HttpClient(handler))
            {
                var tasks = new Task[2];
                tasks[0] = server.RunTest();
                tasks[1] = client.GetStringAsync(requestString);
            
                await Task.WhenAll(tasks).TimeoutAfter(15 * 1000);
            
                if (server.IsInconclusive)
                {
                    _output.WriteLine("Test inconclusive: The Operating system preferred a non-CBC or Null cipher.");
                }
                else
                {
                    Assert.True(server.AuxRecordDetected, "Server reports: Client auxiliary record not detected.");
                }
            }
        }
        public async Task SslStream_ClientAndServerUsesAuxRecord_Ok()
        {
            X509Certificate2 serverCert = Configuration.Certificates.GetServerCertificate();
            var server = new SchSendAuxRecordTestServer(serverCert);

            int port   = server.StartServer();
            var client = new SchSendAuxRecordTestClient("localhost", port);

            var tasks = new Task[2];

            tasks[0] = server.RunTest();
            tasks[1] = client.RunTest();

            await Task.WhenAll(tasks).TimeoutAfter(TestConfiguration.PassingTestTimeoutMilliseconds);

            if (server.IsInconclusive)
            {
                _output.WriteLine("Test inconclusive: The Operating system preferred a non-CBC or Null cipher.");
            }
            else
            {
                Assert.True(server.AuxRecordDetected, "Server reports: Client auxiliary record not detected.");
                Assert.True(client.AuxRecordDetected, "Client reports: Server auxiliary record not detected.");
            }
        }
        public async Task SslStream_ClientAndServerUsesAuxRecord_Ok()
        {
            X509Certificate2 serverCert = Configuration.Certificates.GetServerCertificate();
            var server = new SchSendAuxRecordTestServer(serverCert);

            int port = server.StartServer();
            var client = new SchSendAuxRecordTestClient("localhost", port);

            var tasks = new Task[2];
            tasks[0] = server.RunTest();
            tasks[1] = client.RunTest();

            await Task.WhenAll(tasks).TimeoutAfter(TestConfiguration.PassingTestTimeoutMilliseconds);
            
            if (server.IsInconclusive)
            {
                _output.WriteLine("Test inconclusive: The Operating system preferred a non-CBC or Null cipher.");
            }
            else
            {
                Assert.True(server.AuxRecordDetected, "Server reports: Client auxiliary record not detected.");
                Assert.True(client.AuxRecordDetected, "Client reports: Server auxiliary record not detected.");
            }
        }