[#PKCS5_pbe2_set_iv_ex]
= PKCS5&lowbar;pbe2&lowbar;set&lowbar;iv&lowbar;ex
:mrdocs:

Build a PBES2 AlgorithmIdentifier with explicit IV and library context&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:X509_ALGOR.adoc[X509&lowbar;ALGOR]*
PKCS5&lowbar;pbe2&lowbar;set&lowbar;iv&lowbar;ex(
    xref:EVP_CIPHER-07.adoc[EVP&lowbar;CIPHER] const* cipher,
    int iter,
    unsigned char* salt,
    int saltlen,
    unsigned char* aiv,
    int prf&lowbar;nid,
    xref:OSSL_LIB_CTX.adoc[OSSL&lowbar;LIB&lowbar;CTX]* libctx);
----

== Return Value

New X509&lowbar;ALGOR encoding PBES2 parameters, or NULL on error&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *cipher*
| Content&hyphen;encryption cipher for the PBES2 encryption scheme&period;
| *iter*
| PBKDF2 iteration count&semi; &lt;&equals;0 selects the default&period;
| *salt*
| Optional salt bytes&semi; NULL generates a random salt of `saltlen&period;`
| *saltlen*
| Salt length in bytes when `salt` is NULL &sol; length of `salt&period;`
| *aiv*
| Optional IV bytes for `cipher&semi;` NULL generates a random IV&period;
| *prf&lowbar;nid*
| PBKDF2 PRF NID (for example NID&lowbar;hmacWithSHA256), or &hyphen;1 for the default&period;
| *libctx*
| Library context for random&sol;algorithm fetches, or NULL for the default&period;
|===


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