知道基本加密聊天的任何好例子吗? (GnuTLS?)

发布于 2024-12-09 01:49:17 字数 284 浏览 0 评论 0原文

我想编写一个基本的套接字聊天应用程序,但加密除外。您知道所有那些在命令行中运行服务器和客户端并来回发送消息的套接字编程示例。就像这样,除了良好的加密。

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

呆橘 2024-12-16 01:49:17

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.

£噩梦荏苒 2024-12-16 01:49:17

我强烈建议使用 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.

世态炎凉 2024-12-16 01:49:17

通过阅读问题我知道你对底层技术了解不够。如果您需要示例,可以在以下位置查看 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)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文