Functions¶
x509_to_cert_context¶
-
cert_context_ptr wintls::x509_to_cert_context(const net::const_buffer &x509, file_format format)¶
Convert certificate from standard X509 format to Windows CERT_CONTEXT.
- Parameters:
x509 – Buffer holding the X509 certificate contents.
format – The file_format of the X509 contents.
- Throws:
wintls::system_error – Thrown on failure.
- Returns:
A managed cert_context.
-
cert_context_ptr wintls::x509_to_cert_context(const net::const_buffer &x509, file_format format, wintls::error_code &ec)¶
Convert certificate from standard X509 format to Windows CERT_CONTEXT.
- Parameters:
x509 – Buffer holding the X509 certificate contents.
format – The file_format of the X509 contents.
ec – Set to indicate what error occurred, if any.
- Returns:
A managed cert_context.
import_private_key¶
-
void wintls::import_private_key(const net::const_buffer &private_key, file_format format, const std::string &name)¶
Import a private key into the default cryptographic provider using the given name.
This function can be used to import an RSA private key in PKCS#8 format in to the default certificate provider under the given name.
The key can be associated with a certificate using the assign_private_key function.
Note
Currently only RSA keys are supported.
- Parameters:
private_key – The private key to be imported in PKCS#8 format.
format – The file_format of the private_key.
name – The name used to associate the key.
- Throws:
wintls::system_error – Thrown on failure.
-
void wintls::import_private_key(const net::const_buffer &private_key, file_format format, const std::string &name, wintls::error_code &ec)¶
Import a private key into the default cryptographic provider using the given name.
This function can be used to import an RSA private key in PKCS#8 format in to the default certificate provider under the given name.
The key can be associated with a certificate using the assign_private_key function.
Note
Currently only RSA keys are supported.
- Parameters:
private_key – The private key to be imported in PKCS#8 format.
format – The file_format of the private_key.
name – The name used to associate the key.
ec – Set to indicate what error occurred, if any.
delete_private_key¶
-
void wintls::delete_private_key(const std::string &name)¶
Delete a private key from the default cryptographic provider.
- Parameters:
name – The name of the container storing the private key to delete.
- Throws:
wintls::system_error – Thrown on failure.
-
void wintls::delete_private_key(const std::string &name, wintls::error_code &ec)¶
Delete a private key from the default cryptographic provider.
- Parameters:
name – The name of the container storing the private key to delete.
ec – Set to indicate what error occurred, if any.
assign_private_key¶
-
void wintls::assign_private_key(const CERT_CONTEXT *cert, const std::string &name)¶
Assigns a private key to a certificate.
In order for a CERT_CONTEXT to be used by a server in needs to have a private key associated with it.
This function will associate the named key with the given certificate in order for it be used by eg. context::use_certificate.
Note
No check is done to ensure the key exists. Associating a non existing or non accessible key will result in unexpected behavior when used with a stream operating as a server.
- Parameters:
cert – The certificate to associate with the private key.
name – The name of the private key in the default cryptographic key provider.
- Throws:
wintls::system_error – Thrown on failure.
-
void wintls::assign_private_key(const CERT_CONTEXT *cert, const std::string &name, wintls::error_code &ec)¶
Assigns a private key to a certificate.
In order for a CERT_CONTEXT to be used by a server in needs to have a private key associated with it.
This function will associate the named key with the given certificate in order for it be used by eg. context::use_certificate.
Note
No check is done to ensure the key exists. Associating a non existing or non accessible key will result in unexpected behavior when used with a stream operating as a server.
- Parameters:
cert – The certificate to associate with the private key.
name – The name of the private key in the default cryptographic key provider.
ec – Set to indicate what error occurred, if any.