Linux C/C++ - any way to create a "transparent" SSL/TLS socket?
1
vote
2
answers
2867
views
Normally, in C or C++, to communicate through a SSL/TLS encrypted TCP socket you need to use whatever functions the SSL/TLS provider (OpenSSL, GnuTLS, etc) gives you in order to perform reads & writes, for example: BIO_write, BIO_read, etc.
I have a routine in C which reads and writes from a socket, and I'd like to have the ability to pass it a TLS socket so that it can perform encrypted communication over that connection. However, that would require me to rewrite the function so that it uses the BIO_read, BIO_write etc routines, when I'd like to keep it as it is.
Is there any way that I can create a socket (or convert an existing one) which will have all data written to and read from it automatically encrypted/decrypted (i.e: "transparently"), ideally completely in userspace, so that routines using that socket don't need to worry about how to transmit data though it? Or would I be better off making wrapper routines for those reads/writes that choose which read/write routine to use?
Asked by Joe
(1474 rep)
Aug 10, 2016, 10:24 AM
Last activity: Aug 25, 2021, 01:46 PM
Last activity: Aug 25, 2021, 01:46 PM