[#EVP_CIPHER_CTX_rand_key]
= EVP&lowbar;CIPHER&lowbar;CTX&lowbar;rand&lowbar;key
:mrdocs:

Generate a random key suitable for the cipher currently set on `ctx&period;`

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
int
EVP&lowbar;CIPHER&lowbar;CTX&lowbar;rand&lowbar;key(
    xref:EVP_CIPHER_CTX.adoc[EVP&lowbar;CIPHER&lowbar;CTX]* ctx,
    unsigned char* key);
----

== Return Value

1 on success, or 0 on failure&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *ctx*
| Cipher context whose algorithm determines the key length&period;
| *key*
| Buffer receiving the generated key (at least EVP&lowbar;CIPHER&lowbar;CTX&lowbar;get&lowbar;key&lowbar;length() bytes)&period;
|===


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