[#EVP_PKEY_encapsulate]
= EVP&lowbar;PKEY&lowbar;encapsulate
:mrdocs:

Perform key encapsulation&colon; produce a wrapped key and a shared secret&period;

== Synopsis

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

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

== Return Value

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

== Parameters

[cols="1,4"]
|===
| Name| Description
| *ctx*
| Context previously initialized with EVP&lowbar;PKEY&lowbar;encapsulate&lowbar;init()&period;
| *wrappedkey*
| Buffer receiving the encapsulated key, or NULL to query lengths&period;
| *wrappedkeylen*
| In&sol;out length of `wrappedkey&period;`
| *genkey*
| Buffer receiving the generated shared secret, or NULL to query lengths&period;
| *genkeylen*
| In&sol;out length of `genkey&period;`
|===


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