[#BIO_set_cipher]
= BIO&lowbar;set&lowbar;cipher
:mrdocs:

Configure a cipher filter BIO with algorithm, key, IV, and encrypt&sol;decrypt mode&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
int
BIO&lowbar;set&lowbar;cipher(
    xref:BIO.adoc[BIO]* b,
    xref:EVP_CIPHER-07.adoc[EVP&lowbar;CIPHER] const* c,
    unsigned char const* k,
    unsigned char const* i,
    int enc);
----

== Return Value

1 on success, or 0 on failure&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *b*
| BIO created with BIO&lowbar;f&lowbar;cipher()&period;
| *c*
| Cipher algorithm to use&period;
| *k*
| Key bytes whose length matches the cipher&apos;s key length&period;
| *i*
| IV bytes whose length matches the cipher&apos;s IV length (may be NULL for ECB)&period;
| *enc*
| 1 to encrypt, or 0 to decrypt&period;
|===


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