There are two ways to do this, I know. One of them is configuration parameters, and the other is a run-time parameter.
Configuration option
The configuration parameter is used when building OpenSSL. It is great for all applications because it applies your administrative policy and addresses applications that do not take into account SSL / TLS related issues.
For this parameter, simply configure OpenSSL with no-ssl2 no-ssl3 . no-comp also often used because compression can leak information.
./Configure no-ssl2 no-ssl3 <other opts>
Other OpenSSL options are available, and you might want to visit the "Compile and Install" on the OpenSSL wiki.
Execution option
In C, you need (1) to use the 2/3 method to obtain SSL 2/3 and higher; and then (2) call SSL_CTX_set_options (or SSL_set_options ) and (3) delete the SSL protocols. This leaves the TLS protocols:
SSL_CTX* ctx = SSL_CTX_new(SSLv23_method()); const long flags = SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3 | SSL_OP_NO_COMPRESSION; SSL_CTX_set_options(ctx, flags);
In Python, you do this using OpenSSL.SSL.Context.set_options .
source share