Encapsulate to a recipient public key and derive sender HPKE secrets.
Declared in <openssl/hpke.h>
int
OSSL_HPKE_encap(
OSSL_HPKE_CTX* ctx,
unsigned char* enc,
size_t* enclen,
unsigned char const* pub,
size_t publen,
unsigned char const* info,
size_t infolen);
1 on success, or 0 on error.
| Name | Description |
|---|---|
| ctx | Sender HPKE context (only one successful call allowed per context). |
| enc | Destination for the encapsulated public value; on input *enclen is capacity. |
| enclen | In/out length of enc (updated with bytes written). |
| pub | Recipient public key octets for the suite's KEM. |
| publen | Length of pub in bytes. |
| info | Optional application info bound into key schedule, or NULL if infolen is 0. |
| infolen | Length of info in bytes (must not exceed OSSL_HPKE_MAX_INFOLEN). |