[#SSL_CTX_use_cert_and_key]
= SSL&lowbar;CTX&lowbar;use&lowbar;cert&lowbar;and&lowbar;key
:mrdocs:

Assign a certificate, private key, and optional chain onto an SSL context&period;

== Synopsis

Declared in `&lt;openssl&sol;ssl&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
int
SSL&lowbar;CTX&lowbar;use&lowbar;cert&lowbar;and&lowbar;key(
    xref:SSL_CTX.adoc[SSL&lowbar;CTX]* ctx,
    xref:X509.adoc[X509]* x509,
    xref:EVP_PKEY.adoc[EVP&lowbar;PKEY]* privatekey,
    xref:stack_st_X509.adoc[stack&lowbar;st&lowbar;X509]* chain,
    int override);
----

== Return Value

1 on success, or 0 on failure&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *ctx*
| SSL context that receives the credentials&period;
| *x509*
| End&hyphen;entity X&period;509 certificate (reference count incremented on success)&period;
| *privatekey*
| Matching private key, or NULL to use `x509&apos;s` public key (e&period;g&period; hardware ENGINE)&period;
| *chain*
| Optional intermediate certificate chain, or NULL&period;
| *override*
| If 0, set only when cert&sol;key&sol;chain were all previously unset&semi; if non&hyphen;zero, always replace&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
