Decapsulate a shared secret from a KEM ciphertext using a context from EVP_PKEY_decapsulate_init().

Synopsis

Declared in <openssl/evp.h>

int
EVP_PKEY_decapsulate(
    EVP_PKEY_CTX* ctx,
    unsigned char* unwrapped,
    size_t* unwrappedlen,
    unsigned char const* wrapped,
    size_t wrappedlen);

Return Value

1 on success, or a non‐positive value on failure.

Parameters

Name

Description

ctx

Decapsulation context holding the private key.

unwrapped

Buffer for the recovered shared secret, or NULL to query size via unwrappedlen.

unwrappedlen

On entry, capacity of unwrapped when non‐NULL; on return, bytes written or required.

wrapped

Encapsulation ciphertext bytes.

wrappedlen

Length of wrapped in bytes.

Created with MrDocs