[#EVP_CipherInit_ex]
= EVP&lowbar;CipherInit&lowbar;ex
:mrdocs:

Initialise `ctx` for encryption or decryption with `cipher&period;`

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
int
EVP&lowbar;CipherInit&lowbar;ex(
    xref:EVP_CIPHER_CTX.adoc[EVP&lowbar;CIPHER&lowbar;CTX]* ctx,
    xref:EVP_CIPHER-07.adoc[EVP&lowbar;CIPHER] const* cipher,
    xref:ENGINE.adoc[ENGINE]* impl,
    unsigned char const* key,
    unsigned char const* iv,
    int enc);
----

== Return Value

1 on success, or 0 on error&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *ctx*
| Cipher context to initialise&period;
| *cipher*
| Cipher algorithm, or NULL to keep the current cipher and change key&sol;IV&sol;dir&period;
| *impl*
| Legacy ENGINE, or NULL for the default implementation&period;
| *key*
| Raw key bytes, or NULL to set later&period;
| *iv*
| IV&sol;nonce bytes, or NULL when not required &sol; set later&period;
| *enc*
| 1 to encrypt, 0 to decrypt, or &hyphen;1 to leave the direction unchanged&period;
|===


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