Skip to content

createPkcs7SignedData

Creates a PKCS#7/CMS SignedData with one or more signers over content.

Each signer uses the RFC 5652 Section 5.4 signed-attributes flow: the signature covers a SET OF authenticated attributes carrying contentType and messageDigest (the digest of the encapsulated content). The content is embedded (attached signature), so the result verifies with verifyPkcs7SignedData without any external data.

The content digest is derived from each signer's key (P-256/RSA-SHA256 → SHA-256, P-384 → SHA-384, P-521 → SHA-512, Ed25519 → SHA-512 per RFC 8419).

Returns a CreatePkcs7SignedDataResult: DER, PEM, and base64 forms on success, or a typed failure for caller-correctable input (no signers, a signer source that is not exactly one certificate, or an unsupported signer key).

ts
function createPkcs7SignedData(
	input: CreatePkcs7SignedDataInput,
): Promise<CreatePkcs7SignedDataResult>

Parameters

Released under the MIT License.