rustls_certified_key_build

Build a rustls_certified_key from a certificate chain and a private key. cert_chain must point to a buffer of cert_chain_len bytes, containing a series of PEM-encoded certificates, with the end-entity (leaf) certificate first.

private_key must point to a buffer of private_key_len bytes, containing a PEM-encoded private key in either PKCS#1 or PKCS#8 format.

On success, this writes a pointer to the newly created rustls_certified_key in certified_key_out. That pointer must later be freed with rustls_certified_key_free to avoid memory leaks. Note that internally, this is an atomically reference-counted pointer, so even after the original caller has called rustls_certified_key_free, other objects may retain a pointer to the object. The memory will be freed when all references are gone.

This function does not take ownership of any of its input pointers. It parses the pointed-to data and makes a copy of the result. You may free the cert_chain and private_key pointers after calling it.

Typically, you will build a rustls_certified_key, use it to create a rustls_server_config (which increments the reference count), and then immediately call rustls_certified_key_free. That leaves the rustls_server_config in possession of the sole reference, so the rustls_certified_key's memory will automatically be released when the rustls_server_config is freed.

extern (C)
rustls_certified_key_build

Meta