Decrypt a CMS EnvelopedData structure and return a BIO of the plaintext.

Synopsis

Declared in <openssl/cms.h>

BIO*
CMS_EnvelopedData_decrypt(
    CMS_EnvelopedData* env,
    BIO* detached_data,
    EVP_PKEY* pkey,
    X509* cert,
    ASN1_OCTET_STRING* secret,
    unsigned int flags,
    OSSL_LIB_CTX* libctx,
    char const* propq);

Return Value

BIO containing the decrypted content, or NULL on error.

Parameters

Name

Description

env

EnvelopedData to decrypt.

detached_data

Detached encrypted‐content BIO when applicable; normally NULL.

pkey

Recipient private key when secret is NULL.

cert

Recipient certificate used to select the RecipientInfo; recommended when pkey is set.

secret

Pre‐shared content‐encryption key, or NULL to unwrap with pkey.

flags

Optional CMS decrypt flags (for example CMS_TEXT).

libctx

Library context for algorithm fetches, or NULL for the default.

propq

Property query for provider selection, or NULL.

Created with MrDocs