Пример #1
0
        public async Task Stream2Leto()
        {
            var pipe = new LoopbackPipeline(_factory);

            using (var secPipe = _listener.CreateSecurePipeline(pipe.ServerPipeline))
                using (var client = new SslStream(pipe.ClientPipeline.GetStream(), false, Validate))
                {
                    var taskArray = new Task[2];
                    taskArray[0] = secPipe.HandshakeComplete;
                    taskArray[1] = client.AuthenticateAsClientAsync("tls13.cetus.io");
                    await Task.WhenAll(taskArray);
                }
        }
Пример #2
0
        public async Task Stream2Stream()
        {
            var pipe = new LoopbackPipeline(_factory);

            using (var server = new SslStream(pipe.ServerPipeline.GetStream(), false, Validate))
                using (var client = new SslStream(pipe.ClientPipeline.GetStream(), false, Validate))
                {
                    var taskArray = new Task[2];
                    taskArray[0] = server.AuthenticateAsServerAsync(_certificate, false, System.Security.Authentication.SslProtocols.Tls12, false);
                    taskArray[1] = client.AuthenticateAsClientAsync("tls13.cetus.io");
                    await Task.WhenAll(taskArray);

                    Console.WriteLine($"Algo {client.CipherAlgorithm} strength {client.CipherStrength}");
                }
        }