theom / tls-socket

A Botan TLS socket wrapper.
BSD 2-Clause "Simplified" License
6 stars 1 forks source link

Data Encryption #1

Open ahebadi78 opened 5 years ago

ahebadi78 commented 5 years ago

Thanks for your example code which helped me alot in order to establish a client-server connection using Botan. But I have confused the way you encrypt data in order to send it from one party to another. Also decryption is a little bit of ambiguous. And when do you use the certificate files in cert folder and public-private keys for cryptography stuff. Does Botan handle all these things by itself? If yes by which function call that you had called in you own code!

theom commented 5 years ago

Hi ahebadi78

Good to know the example helped.

It's been a while since I used Botan but IIRC a channel (which handles the actual encryption/decryption) is used to queue the reads and writes. You can see how it is used in tls_socket::read and tls_socket::write. Note that Botan handles the actual TLS handshake behind the scene.

The certificates are managed by the client_credentials_manager and server_credentials_manager classes defined in credentials.hpp. Instances of them are passed to the tls sockets when they are created in run(). Take a closer look at server.cpp and client.cpp and you'll see how it works.

Hope this helps.