知道基本加密聊天的任何好例子吗? (GnuTLS?)
我想编写一个基本的套接字聊天应用程序,但加密除外。您知道所有那些在命令行中运行服务器和客户端并来回发送消息的套接字编程示例。就像这样,除了良好的加密。
Diffie-Hellman 密钥交换,没有任何证书颁发机构的废话,一旦建立连接,也许还有一些 ECDSA。
GnuTLS 支持所有这些,但是将一些文档拼凑在一起比看到已经运行的东西要混乱得多。
PS:语言并不重要,在 Google 上挖掘了数周之后,除了文档片段之外什么也没找到,我真的不在乎。它只需要一些可以工作的代码。
谢谢!
I'd like to write a basic socket chat app, except encrypted. Y'know all those socket programming examples where you run a server and a client in the command line and it sends messages back and forth. Like that, except with good encryption.
Diffie-Hellman key exchange, none of that certificate authority crap, and maybe some ECDSA once the connection is established.
GnuTLS supports all those, but piecing together bits of documentation is a lot more confusing than seeing something already work.
PS: Language doesn't matter, after digging for weeks on The Google and not finding anything but pieces of documentation, I really don't care. It just needs to be some code that works.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Python 拥有强大的 GnuTLS 支持。
如果您使用 debian/ubuntu,您只需 apt-get install python-gnutls 即可。文档中提供了使用twisted 的基本加密客户端/服务器的示例。
Python has great GnuTLS support.
If you use debian/ubuntu, all you need to do is
apt-get install python-gnutls
. In the documentation are examples for a basic encrypted client/server using twisted.我强烈建议使用 SSL 库,例如 OpenSSL。一个好的起点可能是 http://www.rtfm.com/openssl-examples/ 。我通过快速谷歌发现了这一点,但可能还有很多其他的。
I'd strongly recommend using an SSL library such as OpenSSL. A good starting point might be http://www.rtfm.com/openssl-examples/. I found that with a quick google but there are probably many others.
通过阅读问题我知道你对底层技术了解不够。如果您需要示例,可以在以下位置查看 gnutls 示例:
http://www.gnu.org/software /gnutls/manual/html_node/Client-examples.html#Client-examples
但您最好阅读整本手册,了解到底发生了什么,以及 Diffie Hellman 和 ECDSA 如何发挥作用。 (ECDSA 是一种用于签署证书的签名算法)。如果您想完全避免使用证书,GnuTLS 支持根本不需要证书的密码套件(检查 SRP 和 PSK 身份验证)。
(顺便说一句。我是 GnuTLS 的作者之一,所以请考虑任何有偏见的建议)
By reading the question I can understand that you don't understand the underlying technology well. If you want examples you can check the gnutls examples at:
http://www.gnu.org/software/gnutls/manual/html_node/Client-examples.html#Client-examples
But it would be better for you to read the whole manual to understand what is really going on, and how Diffie Hellman and ECDSA come to play. (ECDSA is a signature algorithm used to sign certificates). If you want to avoid certificates at all, GnuTLS supports ciphersuites that do not require certificates at all (check SRP and PSK authentication).
(btw. I'm one of the authors of GnuTLS so consider any suggestions biased)