---
name: "libressl-PKCS7_set_content"
section: "3"
platform: "linux"
package: "libressl"
version: "4.4.0-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/libressl-PKCS7_set_content"
---

# libressl-PKCS7\_set\_content(3)

set the nested contentInfo in a PKCS#7 structure

## NAME

**PKCS7\_set\_content**, **PKCS7\_content\_new** – set the nested contentInfo in a PKCS#7 structure

## SYNOPSIS

Crypto Library (libcrypto, -lcrypto)

**#include \<openssl/pkcs7.h\>**

*int*\

**PKCS7\_set\_content**(*PKCS7 \*outer*, *PKCS7 \*inner*);

*int*\

**PKCS7\_content\_new**(*PKCS7 \*outer*, *int inner\_type*);

## DESCRIPTION

If the *contentType* of the *outer* PKCS7 structure is *SignedData* or *DigestedData*, **PKCS7\_set\_content**() sets the *contentInfo* field of the *content* field of *outer* to *inner*, without copying *inner*. If there was previous *contentInfo*, it is freed rather than overwritten. The rest of the internal state of *outer* and of its *content* remains unchanged.

**PKCS7\_content\_new**() is similar except that it first allocates and initializes a new, empty *inner* object of the given *inner\_type* using PKCS7\_new(3) and PKCS7\_set\_type(3). The *inner\_type* can be any of the NIDs listed in the PKCS7\_set\_type(3) manual.

## RETURN VALUES

These functions return 1 on success or 0 on failure. They fail if the *contentType* of *outer* is unsupported. **PKCS7\_content\_new**() can also fail when memory is exhausted. In case of failure, *outer* remains unchanged.

## SEE ALSO

PKCS7\_dataInit(3), PKCS7\_new(3), PKCS7\_set\_type(3), PKCS7\_sign(3)

## STANDARDS

RFC 2315: PKCS #7: Cryptographic Message Syntax Version 1.5

- Section 7. General syntax

- Section 9. Signed-data content type

- Section 12. Digested-data content type

## HISTORY

These functions first appeared in SSLeay 0.8.1 and have been available since OpenBSD 2.4.

## CAVEATS

Despite the function names, these functions do not set the *content* field of *outer*, but only the *contentInfo* field inside it. The rest of the *content* remains unchanged.
