简单的客户端/服务器,TCP/IP加密消息流,SSL [英] Simple client/server, TCP/IP encrypting the message stream, SSL

查看:121
本文介绍了简单的客户端/服务器,TCP/IP加密消息流,SSL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

编写一些TCP/IP客户端服务器应用程序.基本上,它创建了一个服务器,然后您可以创建几个不同的客户端,并设置一些聊天会话.我想知道有什么方法可以使用标准.net库以某种形式的加密来合并?

Writing a little TCP/IP client server app. Basically it creates a server, and then you can create several different clients and set up a bit of a chat session. What I am wondering is there is any way to incorporate, using standard .net libraries some form of encryption?

m_mainSocket =新的Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);

m_mainSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);

是否有使用rsa进行tcp特化的方法?

Is there any way of speficying tcp using rsa?

还是您(就是我)必须编写一些自定义库来进行密钥交换,然后对后续的聊天消息进行加密?我以前为uni做过,但是那是在java中完成的,但是我知道转换它们并不难.只是试图不必重新发明轮子...

Or would you (me that is) have to write some custom libaries to do key exchange and then encrypt the subsequent chat messages? I have done that before for uni but that was in java but I know it would'nt be hard to convert them. Just trying not to have to reinvent the wheel...

或者利用SSL怎么办?

Or what about utilising a ssl?

谢谢罗恩.

推荐答案

最简单的加密通信方式是将整个套接字流包装在

The simplest way to encrypt your communication would be to just wrap the entire socket stream in a SslStream.

使它直接与TcpClient/TcpListener一起使用,因此使用它加密数据流非常容易.

This is made to work directly with TcpClient/TcpListener, so it's very easy to encrypt a data stream using this.

这篇关于简单的客户端/服务器,TCP/IP加密消息流,SSL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆