EVP_PKEY_decapsulate

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

NameDescription
ctxDecapsulation context holding the private key.
unwrappedBuffer for the recovered shared secret, or NULL to query size via unwrappedlen.
unwrappedlenOn entry, capacity of unwrapped when non-NULL; on return, bytes written or required.
wrappedEncapsulation ciphertext bytes.
wrappedlenLength of wrapped in bytes.