Understanding OpenSSL BIOs
To establish TLS connections and send data over them, we will use OpenSSL Basic Input/Output (BIO) objects. BIOs provide the same Application Programming Interface (API) for working with different types of Input/Output (I/O) channels, such as files, sockets, and TLS streams.
BIOs are divided into two types: source or sink BIOs and filter BIOs. A source or sink BIO represents an I/O endpoint, such as a file or a socket. A filter BIO transforms data that is being passed through the BIO. For example, a cipher BIO encrypts data when being written to and decrypts data when being read from. BIOs can be connected and form a chain of BIOs. For example, an SSL BIO can be connected to a socket BIO, providing TLS communication on a socket.
OpenSSL supports the following source or sink BIOs:
- Accept BIO (
BIO_s_accept
): TCP/IP socket or Unix socket accept routines. - BIO BIO (
BIO_s_bio
): A BIO pair where whatever is written to one half of the pair can be...