开发者

Know any good examples for a basic encrypted chat? (GnuTLS?)

开发者 https://www.devze.com 2023-04-11 04:42 出处:网络
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

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 piec开发者_C百科es of documentation, I really don't care. It just needs to be some code that works.

Thanks!


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.


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.


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)

0

精彩评论

暂无评论...
验证码 换一张
取 消