Boost  v1.57.0
doxygen for www.boost.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
boost::asio::ssl::old::basic_context< Service > Class Template Reference

SSL context. More...

#include <basic_context.hpp>

Inheritance diagram for boost::asio::ssl::old::basic_context< Service >:
Collaboration diagram for boost::asio::ssl::old::basic_context< Service >:

Public Types

typedef Service service_type
 The type of the service that will be used to provide context operations. More...
 
typedef service_type::impl_type impl_type
 The native implementation type of the SSL context. More...
 
enum  method {
  sslv2,
  sslv2_client,
  sslv2_server,
  sslv3,
  sslv3_client,
  sslv3_server,
  tlsv1,
  tlsv1_client,
  tlsv1_server,
  sslv23,
  sslv23_client,
  sslv23_server,
  tlsv11,
  tlsv11_client,
  tlsv11_server,
  tlsv12,
  tlsv12_client,
  tlsv12_server
}
 Different methods supported by a context. More...
 
enum  file_format {
  asn1,
  pem
}
 File format types. More...
 
enum  password_purpose {
  for_reading,
  for_writing
}
 Purpose of PEM password. More...
 
typedef long options
 Bitmask type for SSL options. More...
 
typedef int verify_mode
 

Public Member Functions

 basic_context (boost::asio::io_service &io_service, method m)
 Constructor. More...
 
 ~basic_context ()
 Destructor. More...
 
impl_type impl ()
 Get the underlying implementation in the native type. More...
 
void set_options (options o)
 Set options on the context. More...
 
boost::system::error_code set_options (options o, boost::system::error_code &ec)
 Set options on the context. More...
 
void set_verify_mode (verify_mode v)
 Set the peer verification mode. More...
 
boost::system::error_code set_verify_mode (verify_mode v, boost::system::error_code &ec)
 Set the peer verification mode. More...
 
void load_verify_file (const std::string &filename)
 Load a certification authority file for performing verification. More...
 
boost::system::error_code load_verify_file (const std::string &filename, boost::system::error_code &ec)
 Load a certification authority file for performing verification. More...
 
void add_verify_path (const std::string &path)
 Add a directory containing certificate authority files to be used for performing verification. More...
 
boost::system::error_code add_verify_path (const std::string &path, boost::system::error_code &ec)
 Add a directory containing certificate authority files to be used for performing verification. More...
 
void use_certificate_file (const std::string &filename, file_format format)
 Use a certificate from a file. More...
 
boost::system::error_code use_certificate_file (const std::string &filename, file_format format, boost::system::error_code &ec)
 Use a certificate from a file. More...
 
void use_certificate_chain_file (const std::string &filename)
 Use a certificate chain from a file. More...
 
boost::system::error_code use_certificate_chain_file (const std::string &filename, boost::system::error_code &ec)
 Use a certificate chain from a file. More...
 
void use_private_key_file (const std::string &filename, file_format format)
 Use a private key from a file. More...
 
boost::system::error_code use_private_key_file (const std::string &filename, file_format format, boost::system::error_code &ec)
 Use a private key from a file. More...
 
void use_rsa_private_key_file (const std::string &filename, file_format format)
 Use an RSA private key from a file. More...
 
boost::system::error_code use_rsa_private_key_file (const std::string &filename, file_format format, boost::system::error_code &ec)
 Use an RSA private key from a file. More...
 
void use_tmp_dh_file (const std::string &filename)
 Use the specified file to obtain the temporary Diffie-Hellman parameters. More...
 
boost::system::error_code use_tmp_dh_file (const std::string &filename, boost::system::error_code &ec)
 Use the specified file to obtain the temporary Diffie-Hellman parameters. More...
 
template<typename PasswordCallback >
void set_password_callback (PasswordCallback callback)
 Set the password callback. More...
 
template<typename PasswordCallback >
boost::system::error_code set_password_callback (PasswordCallback callback, boost::system::error_code &ec)
 Set the password callback. More...
 
 BOOST_ASIO_STATIC_CONSTANT (long, default_workarounds=SSL_OP_ALL)
 
 BOOST_ASIO_STATIC_CONSTANT (long, single_dh_use=SSL_OP_SINGLE_DH_USE)
 
 BOOST_ASIO_STATIC_CONSTANT (long, no_sslv2=SSL_OP_NO_SSLv2)
 
 BOOST_ASIO_STATIC_CONSTANT (long, no_sslv3=SSL_OP_NO_SSLv3)
 
 BOOST_ASIO_STATIC_CONSTANT (long, no_tlsv1=SSL_OP_NO_TLSv1)
 
 BOOST_ASIO_STATIC_CONSTANT (long, no_compression=0x20000L)
 
 BOOST_ASIO_STATIC_CONSTANT (int, verify_none=SSL_VERIFY_NONE)
 
 BOOST_ASIO_STATIC_CONSTANT (int, verify_peer=SSL_VERIFY_PEER)
 
 BOOST_ASIO_STATIC_CONSTANT (int, verify_fail_if_no_peer_cert=SSL_VERIFY_FAIL_IF_NO_PEER_CERT)
 
 BOOST_ASIO_STATIC_CONSTANT (int, verify_client_once=SSL_VERIFY_CLIENT_ONCE)
 

Detailed Description

template<typename Service>
class boost::asio::ssl::old::basic_context< Service >

SSL context.

Member Typedef Documentation

template<typename Service>
typedef service_type::impl_type boost::asio::ssl::old::basic_context< Service >::impl_type

The native implementation type of the SSL context.

Bitmask type for SSL options.

template<typename Service>
typedef Service boost::asio::ssl::old::basic_context< Service >::service_type

The type of the service that will be used to provide context operations.

Member Enumeration Documentation

File format types.

Enumerator
asn1 

ASN.1 file.

pem 

PEM file.

Different methods supported by a context.

Enumerator
sslv2 

Generic SSL version 2.

sslv2_client 

SSL version 2 client.

sslv2_server 

SSL version 2 server.

sslv3 

Generic SSL version 3.

sslv3_client 

SSL version 3 client.

sslv3_server 

SSL version 3 server.

tlsv1 

Generic TLS version 1.

tlsv1_client 

TLS version 1 client.

tlsv1_server 

TLS version 1 server.

sslv23 

Generic SSL/TLS.

sslv23_client 

SSL/TLS client.

sslv23_server 

SSL/TLS server.

tlsv11 

Generic TLS version 1.1.

tlsv11_client 

TLS version 1.1 client.

tlsv11_server 

TLS version 1.1 server.

tlsv12 

Generic TLS version 1.2.

tlsv12_client 

TLS version 1.2 client.

tlsv12_server 

TLS version 1.2 server.

Purpose of PEM password.

Enumerator
for_reading 

The password is needed for reading/decryption.

for_writing 

The password is needed for writing/encryption.

Constructor & Destructor Documentation

template<typename Service>
boost::asio::ssl::old::basic_context< Service >::basic_context ( boost::asio::io_service io_service,
method  m 
)
inline

Constructor.

template<typename Service>
boost::asio::ssl::old::basic_context< Service >::~basic_context ( )
inline

Destructor.

Member Function Documentation

template<typename Service>
void boost::asio::ssl::old::basic_context< Service >::add_verify_path ( const std::string &  path)
inline

Add a directory containing certificate authority files to be used for performing verification.

This function is used to specify the name of a directory containing certification authority certificates. Each file in the directory must contain a single certificate. The files must be named using the subject name's hash and an extension of ".0".

Parameters
pathThe name of a directory containing the certificates.
Exceptions
boost::system::system_errorThrown on failure.
template<typename Service>
boost::system::error_code boost::asio::ssl::old::basic_context< Service >::add_verify_path ( const std::string &  path,
boost::system::error_code ec 
)
inline

Add a directory containing certificate authority files to be used for performing verification.

This function is used to specify the name of a directory containing certification authority certificates. Each file in the directory must contain a single certificate. The files must be named using the subject name's hash and an extension of ".0".

Parameters
pathThe name of a directory containing the certificates.
ecSet to indicate what error occurred, if any.
boost::asio::ssl::context_base::BOOST_ASIO_STATIC_CONSTANT ( long  ,
default_workarounds  = SSL_OP_ALL 
)
inherited
boost::asio::ssl::context_base::BOOST_ASIO_STATIC_CONSTANT ( long  ,
single_dh_use  = SSL_OP_SINGLE_DH_USE 
)
inherited
boost::asio::ssl::context_base::BOOST_ASIO_STATIC_CONSTANT ( long  ,
no_sslv2  = SSL_OP_NO_SSLv2 
)
inherited
boost::asio::ssl::context_base::BOOST_ASIO_STATIC_CONSTANT ( long  ,
no_sslv3  = SSL_OP_NO_SSLv3 
)
inherited
boost::asio::ssl::context_base::BOOST_ASIO_STATIC_CONSTANT ( long  ,
no_tlsv1  = SSL_OP_NO_TLSv1 
)
inherited
boost::asio::ssl::context_base::BOOST_ASIO_STATIC_CONSTANT ( long  ,
no_compression  = 0x20000L 
)
inherited
boost::asio::ssl::context_base::BOOST_ASIO_STATIC_CONSTANT ( int  ,
verify_none  = SSL_VERIFY_NONE 
)
inherited
boost::asio::ssl::context_base::BOOST_ASIO_STATIC_CONSTANT ( int  ,
verify_peer  = SSL_VERIFY_PEER 
)
inherited
boost::asio::ssl::context_base::BOOST_ASIO_STATIC_CONSTANT ( int  ,
verify_fail_if_no_peer_cert  = SSL_VERIFY_FAIL_IF_NO_PEER_CERT 
)
inherited
boost::asio::ssl::context_base::BOOST_ASIO_STATIC_CONSTANT ( int  ,
verify_client_once  = SSL_VERIFY_CLIENT_ONCE 
)
inherited
template<typename Service>
impl_type boost::asio::ssl::old::basic_context< Service >::impl ( )
inline

Get the underlying implementation in the native type.

This function may be used to obtain the underlying implementation of the context. This is intended to allow access to context functionality that is not otherwise provided.

template<typename Service>
void boost::asio::ssl::old::basic_context< Service >::load_verify_file ( const std::string &  filename)
inline

Load a certification authority file for performing verification.

This function is used to load one or more trusted certification authorities from a file.

Parameters
filenameThe name of a file containing certification authority certificates in PEM format.
Exceptions
boost::system::system_errorThrown on failure.
template<typename Service>
boost::system::error_code boost::asio::ssl::old::basic_context< Service >::load_verify_file ( const std::string &  filename,
boost::system::error_code ec 
)
inline

Load a certification authority file for performing verification.

This function is used to load the certificates for one or more trusted certification authorities from a file.

Parameters
filenameThe name of a file containing certification authority certificates in PEM format.
ecSet to indicate what error occurred, if any.
template<typename Service>
void boost::asio::ssl::old::basic_context< Service >::set_options ( options  o)
inline

Set options on the context.

This function may be used to configure the SSL options used by the context.

Parameters
oA bitmask of options. The available option values are defined in the context_base class. The options are bitwise-ored with any existing value for the options.
Exceptions
boost::system::system_errorThrown on failure.
template<typename Service>
boost::system::error_code boost::asio::ssl::old::basic_context< Service >::set_options ( options  o,
boost::system::error_code ec 
)
inline

Set options on the context.

This function may be used to configure the SSL options used by the context.

Parameters
oA bitmask of options. The available option values are defined in the context_base class. The options are bitwise-ored with any existing value for the options.
ecSet to indicate what error occurred, if any.
template<typename Service>
template<typename PasswordCallback >
void boost::asio::ssl::old::basic_context< Service >::set_password_callback ( PasswordCallback  callback)
inline

Set the password callback.

This function is used to specify a callback function to obtain password information about an encrypted key in PEM format.

Parameters
callbackThe function object to be used for obtaining the password. The function signature of the handler must be:
std::string password_callback(
std::size_t max_length, // The maximum size for a password.
password_purpose purpose // Whether password is for reading or writing.
);
The return value of the callback is a string containing the password.
Exceptions
boost::system::system_errorThrown on failure.
template<typename Service>
template<typename PasswordCallback >
boost::system::error_code boost::asio::ssl::old::basic_context< Service >::set_password_callback ( PasswordCallback  callback,
boost::system::error_code ec 
)
inline

Set the password callback.

This function is used to specify a callback function to obtain password information about an encrypted key in PEM format.

Parameters
callbackThe function object to be used for obtaining the password. The function signature of the handler must be:
std::string password_callback(
std::size_t max_length, // The maximum size for a password.
password_purpose purpose // Whether password is for reading or writing.
);
The return value of the callback is a string containing the password.
ecSet to indicate what error occurred, if any.
template<typename Service>
void boost::asio::ssl::old::basic_context< Service >::set_verify_mode ( verify_mode  v)
inline

Set the peer verification mode.

This function may be used to configure the peer verification mode used by the context.

Parameters
vA bitmask of peer verification modes. The available verify_mode values are defined in the context_base class.
Exceptions
boost::system::system_errorThrown on failure.
template<typename Service>
boost::system::error_code boost::asio::ssl::old::basic_context< Service >::set_verify_mode ( verify_mode  v,
boost::system::error_code ec 
)
inline

Set the peer verification mode.

This function may be used to configure the peer verification mode used by the context.

Parameters
vA bitmask of peer verification modes. The available verify_mode values are defined in the context_base class.
ecSet to indicate what error occurred, if any.
template<typename Service>
void boost::asio::ssl::old::basic_context< Service >::use_certificate_chain_file ( const std::string &  filename)
inline

Use a certificate chain from a file.

This function is used to load a certificate chain into the context from a file.

Parameters
filenameThe name of the file containing the certificate. The file must use the PEM format.
Exceptions
boost::system::system_errorThrown on failure.
template<typename Service>
boost::system::error_code boost::asio::ssl::old::basic_context< Service >::use_certificate_chain_file ( const std::string &  filename,
boost::system::error_code ec 
)
inline

Use a certificate chain from a file.

This function is used to load a certificate chain into the context from a file.

Parameters
filenameThe name of the file containing the certificate. The file must use the PEM format.
ecSet to indicate what error occurred, if any.
template<typename Service>
void boost::asio::ssl::old::basic_context< Service >::use_certificate_file ( const std::string &  filename,
file_format  format 
)
inline

Use a certificate from a file.

This function is used to load a certificate into the context from a file.

Parameters
filenameThe name of the file containing the certificate.
formatThe file format (ASN.1 or PEM).
Exceptions
boost::system::system_errorThrown on failure.
template<typename Service>
boost::system::error_code boost::asio::ssl::old::basic_context< Service >::use_certificate_file ( const std::string &  filename,
file_format  format,
boost::system::error_code ec 
)
inline

Use a certificate from a file.

This function is used to load a certificate into the context from a file.

Parameters
filenameThe name of the file containing the certificate.
formatThe file format (ASN.1 or PEM).
ecSet to indicate what error occurred, if any.
template<typename Service>
void boost::asio::ssl::old::basic_context< Service >::use_private_key_file ( const std::string &  filename,
file_format  format 
)
inline

Use a private key from a file.

This function is used to load a private key into the context from a file.

Parameters
filenameThe name of the file containing the private key.
formatThe file format (ASN.1 or PEM).
Exceptions
boost::system::system_errorThrown on failure.
template<typename Service>
boost::system::error_code boost::asio::ssl::old::basic_context< Service >::use_private_key_file ( const std::string &  filename,
file_format  format,
boost::system::error_code ec 
)
inline

Use a private key from a file.

This function is used to load a private key into the context from a file.

Parameters
filenameThe name of the file containing the private key.
formatThe file format (ASN.1 or PEM).
ecSet to indicate what error occurred, if any.
template<typename Service>
void boost::asio::ssl::old::basic_context< Service >::use_rsa_private_key_file ( const std::string &  filename,
file_format  format 
)
inline

Use an RSA private key from a file.

This function is used to load an RSA private key into the context from a file.

Parameters
filenameThe name of the file containing the RSA private key.
formatThe file format (ASN.1 or PEM).
Exceptions
boost::system::system_errorThrown on failure.
template<typename Service>
boost::system::error_code boost::asio::ssl::old::basic_context< Service >::use_rsa_private_key_file ( const std::string &  filename,
file_format  format,
boost::system::error_code ec 
)
inline

Use an RSA private key from a file.

This function is used to load an RSA private key into the context from a file.

Parameters
filenameThe name of the file containing the RSA private key.
formatThe file format (ASN.1 or PEM).
ecSet to indicate what error occurred, if any.
template<typename Service>
void boost::asio::ssl::old::basic_context< Service >::use_tmp_dh_file ( const std::string &  filename)
inline

Use the specified file to obtain the temporary Diffie-Hellman parameters.

This function is used to load Diffie-Hellman parameters into the context from a file.

Parameters
filenameThe name of the file containing the Diffie-Hellman parameters. The file must use the PEM format.
Exceptions
boost::system::system_errorThrown on failure.
template<typename Service>
boost::system::error_code boost::asio::ssl::old::basic_context< Service >::use_tmp_dh_file ( const std::string &  filename,
boost::system::error_code ec 
)
inline

Use the specified file to obtain the temporary Diffie-Hellman parameters.

This function is used to load Diffie-Hellman parameters into the context from a file.

Parameters
filenameThe name of the file containing the Diffie-Hellman parameters. The file must use the PEM format.
ecSet to indicate what error occurred, if any.

The documentation for this class was generated from the following file: