SSL_CTX_new 3 2008-05-09 0.9.9-dev OpenSSL

NAME

SSL_CTX_new - create a new SSL_CTX object as framework for TLS/SSL enabled functions

LIBRARY

libcrypto, -lcrypto

SYNOPSIS


 #include 


 SSL_CTX *SSL_CTX_new(const SSL_METHOD *method);

DESCRIPTION

_S_S_L___C_T_X___n_e_w_(_) creates a new SSSSLL__CCTTXX object as framework to establish TLS/SSL enabled connections.

NOTES

The SSL_CTX object uses mmeetthhoodd as connection method. The methods exist in a generic type (for client and server use), a server only type, and a client only type. mmeetthhoodd can be of the following types:
SSLv2_method(void), SSLv2_server_method(void), SSLv2_client_method(void) A TLS/SSL connection established with these methods will only understand
the SSLv2 protocol. A client will send out SSLv2 client hello messages and will also indicate that it only understand SSLv2. A server will only understand SSLv2 client hello messages.
SSLv3_method(void), SSLv3_server_method(void), SSLv3_client_method(void) A TLS/SSL connection established with these methods will only understand the
SSLv3 protocol. A client will send out SSLv3 client hello messages and will indicate that it only understands SSLv3. A server will only understand SSLv3 client hello messages. This especially means, that it will not understand SSLv2 client hello messages which are widely used for compatibility reasons, see SSLv23_*___m_e_t_h_o_d_(_).
TLSv1_method(void), TLSv1_server_method(void), TLSv1_client_method(void) A TLS/SSL connection established with these methods will only understand the
TLSv1 protocol. A client will send out TLSv1 client hello messages and will indicate that it only understands TLSv1. A server will only understand TLSv1 client hello messages. This especially means, that it will not understand SSLv2 client hello messages which are widely used for compatibility reasons, see SSLv23_*___m_e_t_h_o_d_(_). It will also not understand SSLv3 client hello messages.
SSLv23_method(void), SSLv23_server_method(void), SSLv23_client_method(void) A TLS/SSL connection established with these methods will understand the SSLv2,
SSLv3, and TLSv1 protocol. A client will send out SSLv2 client hello messages and will indicate that it also understands SSLv3 and TLSv1. A server will understand SSLv2, SSLv3, and TLSv1 client hello messages. This is the best choice when compatibility is a concern.

The list of protocols available can later be limited using the SSL_OP_NO_SSLv2, SSL_OP_NO_SSLv3, SSL_OP_NO_TLSv1 options of the _SS_SS_LL____CC_TT_XX____ss_ee_tt____oo_pp_tt_ii_oo_nn_ss_((_)) or _SS_SS_LL____ss_ee_tt____oo_pp_tt_ii_oo_nn_ss_((_)) functions. Using these options it is possible to choose e.g. _S_S_L_v_2_3___s_e_r_v_e_r___m_e_t_h_o_d_(_) and be able to negotiate with all possible clients, but to only allow newer protocols like SSLv3 or TLSv1.

_S_S_L___C_T_X___n_e_w_(_) initializes the list of ciphers, the session cache setting, the callbacks, the keys and certificates, and the options to its default values.

RETURN VALUES

The following return values can occur:
NULL The creation of a new SSL_CTX object failed. Check the error stack to
find out the reason.
Pointer to an SSL_CTX object The return value points to an allocated SSL_CTX object.

SEE ALSO

_S_S_L___C_T_X___f_r_e_e(3), _S_S_L___a_c_c_e_p_t(3), _s_s_l(3), _S_S_L___s_e_t___c_o_n_n_e_c_t___s_t_a_t_e(3)