Quantcast
Channel: #Zyan Communication Framework
Viewing all articles
Browse latest Browse all 665

Commented Issue: [en] Bad encryption settings may crash server [1980]

$
0
0
When unsecure client connects to the secure server, the server will crash due to an exception thrown by server channel encryption sinks. Here is the example:

``` c#
// Compile: csc test.cs /r:Zyan.Communication.dll

using System;
using System.Collections;
using System.Linq;
using Zyan.Communication;
using Zyan.Communication.Protocols.Tcp;
using Zyan.Communication.Security;

struct Program
{
static void Main(string[] args)
{
if (args.Any())
RunClient(args);
else
RunServer();
}

static void RunServer()
{
var port = 1234;
var auth = new NullAuthenticationProvider();
var protocol = new TcpDuplexServerProtocolSetup(port, auth, true);

using (var host = new ZyanComponentHost("SecureServer", protocol))
{
Console.WriteLine("Server started. Press ENTER to quit");
Console.ReadLine();
}
}

static void RunClient(string[] args)
{
// insecure client
var clientProtocol = new TcpDuplexClientProtocolSetup(false);
using (var conn1 = new ZyanConnection("tcpex://localhost:1234/SecureServer", clientProtocol))
{
Console.WriteLine("Connected to server. Press ENTER to quit.");
Console.ReadLine();
}
}
}
```
Comments: ** Comment from web user: yallie **

>I found another solution

Sorry, didn't see this post :)
It looks like the cleanest solution to the problem!

Thanks a lot!
I'll try it out tomorrow.


Viewing all articles
Browse latest Browse all 665

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>