[#EVP_PKEY_derive_set_peer_ex]
= EVP&lowbar;PKEY&lowbar;derive&lowbar;set&lowbar;peer&lowbar;ex
:mrdocs:

Set the peer public key for derivation, optionally validating it first&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
int
EVP&lowbar;PKEY&lowbar;derive&lowbar;set&lowbar;peer&lowbar;ex(
    xref:EVP_PKEY_CTX.adoc[EVP&lowbar;PKEY&lowbar;CTX]* ctx,
    xref:EVP_PKEY.adoc[EVP&lowbar;PKEY]* peer,
    int validate&lowbar;peer);
----

== Return Value

1 on success, or a non&hyphen;positive value on failure&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *ctx*
| Derivation context previously initialized with EVP&lowbar;PKEY&lowbar;derive&lowbar;init() or &lowbar;ex()&period;
| *peer*
| Peer&apos;s public key used to compute the shared secret&period;
| *validate&lowbar;peer*
| Non&hyphen;zero to run a public&hyphen;key check on `peer` before use, or 0 to skip&period;
|===


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