[#OSSL_HPKE_keygen]
= OSSL&lowbar;HPKE&lowbar;keygen
:mrdocs:

Generate an HPKE recipient key pair for `suite,` optionally from IKM&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
int
OSSL&lowbar;HPKE&lowbar;keygen(
    OSSL&lowbar;HPKE&lowbar;SUITE suite,
    unsigned char* pub,
    size&lowbar;t* publen,
    xref:EVP_PKEY.adoc[EVP&lowbar;PKEY]** priv,
    unsigned char const* ikm,
    size&lowbar;t ikmlen,
    xref:OSSL_LIB_CTX.adoc[OSSL&lowbar;LIB&lowbar;CTX]* libctx,
    char const* propq);
----

== Return Value

1 on success, or 0 on error&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *suite*
| Suite whose KEM determines the key type&period;
| *pub*
| Destination for the encoded public key&semi; on input &ast;`publen` is capacity&period;
| *publen*
| In&sol;out public&hyphen;key length&period;
| *priv*
| Address of an EVP&lowbar;PKEY&ast; set to the new private key on success&period;
| *ikm*
| Optional input key material for deterministic generation, or NULL for random&period;
| *ikmlen*
| Length of `ikm` (0 when `ikm` is NULL)&semi; should be &gt;&equals; recommended IKM length&period;
| *libctx*
| Library context for algorithm fetches, or NULL for the default&period;
| *propq*
| Optional property query string, or NULL&period;
|===


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