[#EVP_PKEY_derive]
= EVP&lowbar;PKEY&lowbar;derive
:mrdocs:

Derive a shared secret using a context initialized with EVP&lowbar;PKEY&lowbar;derive&lowbar;init()&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
int
EVP&lowbar;PKEY&lowbar;derive(
    xref:EVP_PKEY_CTX.adoc[EVP&lowbar;PKEY&lowbar;CTX]* ctx,
    unsigned char* key,
    size&lowbar;t* keylen);
----

== Return Value

1 on success, or 0 &sol; a negative value on failure&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *ctx*
| Key derivation context that already has a peer key configured when required&period;
| *key*
| Output buffer for the shared secret, or NULL to query the required length&period;
| *keylen*
| On input, size of `key&semi;` on output, number of bytes written or required&period;
|===


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