boost::corosio::tls_context::use_private_key_file

Load the private key from a file.

Synopsis

std::error_code
use_private_key_file(
    std::string_view filename,
    tls_file_format format);

Description

Sets the private key corresponding to the entity certificate. The key must match the certificate loaded via use_certificate_file() or use_certificate_chain_file().

If the key file is encrypted, set a password callback via set_password_callback() before calling this function.

Example

ctx.use_private_key_file( "server.key", tls_file_format::pem );

Return Value

Success, or an error if the file could not be read, the key is invalid, or it doesn't match the certificate.

Parameters

Name Description

filename

Path to the private key file.

format

The encoding format of the file.

See Also

use_private_key

set_password_callback

Created with MrDocs