SSL_CTX_new.pod 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. =pod
  2. =head1 NAME
  3. SSL_CTX_new,
  4. SSLv23_method, SSLv23_server_method, SSLv23_client_method,
  5. TLSv1_2_method, TLSv1_2_server_method, TLSv1_2_client_method,
  6. TLSv1_1_method, TLSv1_1_server_method, TLSv1_1_client_method,
  7. TLSv1_method, TLSv1_server_method, TLSv1_client_method,
  8. SSLv3_method, SSLv3_server_method, SSLv3_client_method,
  9. SSLv2_method, SSLv2_server_method, SSLv2_client_method,
  10. DTLS_method, DTLS_server_method, DTLS_client_method,
  11. DTLSv1_2_method, DTLSv1_2_server_method, DTLSv1_2_client_method,
  12. DTLSv1_method, DTLSv1_server_method, DTLSv1_client_method -
  13. create a new SSL_CTX object as framework for TLS/SSL enabled functions
  14. =head1 SYNOPSIS
  15. #include <openssl/ssl.h>
  16. SSL_CTX *SSL_CTX_new(const SSL_METHOD *method);
  17. const SSL_METHOD *SSLv23_method(void);
  18. const SSL_METHOD *SSLv23_server_method(void);
  19. const SSL_METHOD *SSLv23_client_method(void);
  20. const SSL_METHOD *TLSv1_2_method(void);
  21. const SSL_METHOD *TLSv1_2_server_method(void);
  22. const SSL_METHOD *TLSv1_2_client_method(void);
  23. const SSL_METHOD *TLSv1_1_method(void);
  24. const SSL_METHOD *TLSv1_1_server_method(void);
  25. const SSL_METHOD *TLSv1_1_client_method(void);
  26. const SSL_METHOD *TLSv1_method(void);
  27. const SSL_METHOD *TLSv1_server_method(void);
  28. const SSL_METHOD *TLSv1_client_method(void);
  29. #ifndef OPENSSL_NO_SSL3_METHOD
  30. const SSL_METHOD *SSLv3_method(void);
  31. const SSL_METHOD *SSLv3_server_method(void);
  32. const SSL_METHOD *SSLv3_client_method(void);
  33. #endif
  34. #ifndef OPENSSL_NO_SSL2
  35. const SSL_METHOD *SSLv2_method(void);
  36. const SSL_METHOD *SSLv2_server_method(void);
  37. const SSL_METHOD *SSLv2_client_method(void);
  38. #endif
  39. const SSL_METHOD *DTLS_method(void);
  40. const SSL_METHOD *DTLS_server_method(void);
  41. const SSL_METHOD *DTLS_client_method(void);
  42. const SSL_METHOD *DTLSv1_2_method(void);
  43. const SSL_METHOD *DTLSv1_2_server_method(void);
  44. const SSL_METHOD *DTLSv1_2_client_method(void);
  45. const SSL_METHOD *DTLSv1_method(void);
  46. const SSL_METHOD *DTLSv1_server_method(void);
  47. const SSL_METHOD *DTLSv1_client_method(void);
  48. =head1 DESCRIPTION
  49. SSL_CTX_new() creates a new B<SSL_CTX> object as framework to establish
  50. TLS/SSL enabled connections.
  51. =head1 NOTES
  52. The SSL_CTX object uses B<method> as connection method. The methods exist
  53. in a generic type (for client and server use), a server only type, and a
  54. client only type. B<method> can be of the following types:
  55. =over 4
  56. =item SSLv23_method(), SSLv23_server_method(), SSLv23_client_method()
  57. These are the general-purpose I<version-flexible> SSL/TLS methods.
  58. The actual protocol version used will be negotiated to the highest version
  59. mutually supported by the client and the server.
  60. The supported protocols are SSLv2, SSLv3, TLSv1, TLSv1.1 and TLSv1.2.
  61. Most applications should use these method, and avoid the version specific
  62. methods described below.
  63. The list of protocols available can be further limited using the
  64. B<SSL_OP_NO_SSLv2>, B<SSL_OP_NO_SSLv3>, B<SSL_OP_NO_TLSv1>,
  65. B<SSL_OP_NO_TLSv1_1> and B<SSL_OP_NO_TLSv1_2> options of the
  66. L<SSL_CTX_set_options(3)> or L<SSL_set_options(3)> functions.
  67. Clients should avoid creating "holes" in the set of protocols they support,
  68. when disabling a protocol, make sure that you also disable either all previous
  69. or all subsequent protocol versions.
  70. In clients, when a protocol version is disabled without disabling I<all>
  71. previous protocol versions, the effect is to also disable all subsequent
  72. protocol versions.
  73. The SSLv2 and SSLv3 protocols are deprecated and should generally not be used.
  74. Applications should typically use L<SSL_CTX_set_options(3)> in combination with
  75. the B<SSL_OP_NO_SSLv3> flag to disable negotiation of SSLv3 via the above
  76. I<version-flexible> SSL/TLS methods.
  77. The B<SSL_OP_NO_SSLv2> option is set by default, and would need to be cleared
  78. via L<SSL_CTX_clear_options(3)> in order to enable negotiation of SSLv2.
  79. =item TLSv1_2_method(), TLSv1_2_server_method(), TLSv1_2_client_method()
  80. A TLS/SSL connection established with these methods will only understand the
  81. TLSv1.2 protocol. A client will send out TLSv1.2 client hello messages and
  82. will also indicate that it only understand TLSv1.2. A server will only
  83. understand TLSv1.2 client hello messages.
  84. =item TLSv1_1_method(), TLSv1_1_server_method(), TLSv1_1_client_method()
  85. A TLS/SSL connection established with these methods will only understand the
  86. TLSv1.1 protocol. A client will send out TLSv1.1 client hello messages and
  87. will also indicate that it only understand TLSv1.1. A server will only
  88. understand TLSv1.1 client hello messages.
  89. =item TLSv1_method(), TLSv1_server_method(), TLSv1_client_method()
  90. A TLS/SSL connection established with these methods will only understand the
  91. TLSv1 protocol. A client will send out TLSv1 client hello messages and will
  92. indicate that it only understands TLSv1. A server will only understand TLSv1
  93. client hello messages.
  94. =item SSLv3_method(), SSLv3_server_method(), SSLv3_client_method()
  95. A TLS/SSL connection established with these methods will only understand the
  96. SSLv3 protocol. A client will send out SSLv3 client hello messages and will
  97. indicate that it only understands SSLv3. A server will only understand SSLv3
  98. client hello messages. The SSLv3 protocol is deprecated and should not be
  99. used.
  100. =item SSLv2_method(), SSLv2_server_method(), SSLv2_client_method()
  101. A TLS/SSL connection established with these methods will only understand the
  102. SSLv2 protocol. A client will send out SSLv2 client hello messages and will
  103. also indicate that it only understand SSLv2. A server will only understand
  104. SSLv2 client hello messages. The SSLv2 protocol offers little to no security
  105. and should not be used.
  106. As of OpenSSL 1.0.2g, EXPORT ciphers and 56-bit DES are no longer available
  107. with SSLv2.
  108. =item DTLS_method(), DTLS_server_method(), DTLS_client_method()
  109. These are the version-flexible DTLS methods.
  110. =item DTLSv1_2_method(), DTLSv1_2_server_method(), DTLSv1_2_client_method()
  111. These are the version-specific methods for DTLSv1.2.
  112. =item DTLSv1_method(), DTLSv1_server_method(), DTLSv1_client_method()
  113. These are the version-specific methods for DTLSv1.
  114. =back
  115. SSL_CTX_new() initializes the list of ciphers, the session cache setting, the
  116. callbacks, the keys and certificates and the options to its default values.
  117. =head1 RETURN VALUES
  118. The following return values can occur:
  119. =over 4
  120. =item NULL
  121. The creation of a new SSL_CTX object failed. Check the error stack to find out
  122. the reason.
  123. =item Pointer to an SSL_CTX object
  124. The return value points to an allocated SSL_CTX object.
  125. =back
  126. =head1 SEE ALSO
  127. L<SSL_CTX_set_options(3)>, L<SSL_CTX_clear_options(3)>, L<SSL_set_options(3)>,
  128. L<SSL_CTX_free(3)|SSL_CTX_free(3)>, L<SSL_accept(3)|SSL_accept(3)>,
  129. L<ssl(3)|ssl(3)>, L<SSL_set_connect_state(3)|SSL_set_connect_state(3)>
  130. =cut