Aug 6, 2017 12:08 AM
(This post was last modified: Aug 6, 2017 12:11 AM by Byte™.)
So I know how to create a bio and connect/perform a handshake right away using this plain method: (Simplified with no error checking)
But is there a way to create a connect with BIO_new_connect() and then perform a handshake later with the same bio that BIO_new_connect() made?
The reason I ask is because am creating a small email library for my self and the TLS SMTP server from gmail requires you to connect insecurely first, then send the STARTTLS command then perform the handshake. Problem is I don't know how to perform a handshake on non-insecure bio. I've been searching but it seems like the OpenSSL documentation is truly scattered and the information that is there is vague or not related to what I am looking for.
Quote: SSL_CTX ctx = SSL_CTX_new(TLSv1_2_client_method());
SSL ssl;
BIO *bio = BIO_new_ssl_connect("ctx");
BIO_get_ssl(bio, &ssl);
SSL_set_mode(ssl, SSL_MODE_AUTO_RETRY);
BIO_set_conn_hostname(bio, "smtp.gmail.com:465");
BIO_do_connect(bio);
But is there a way to create a connect with BIO_new_connect() and then perform a handshake later with the same bio that BIO_new_connect() made?
The reason I ask is because am creating a small email library for my self and the TLS SMTP server from gmail requires you to connect insecurely first, then send the STARTTLS command then perform the handshake. Problem is I don't know how to perform a handshake on non-insecure bio. I've been searching but it seems like the OpenSSL documentation is truly scattered and the information that is there is vague or not related to what I am looking for.
C++ Enthusiast


