PKI-Lite - v1.0.5
    Preparing search index...

    Builder class for creating CMS/PKCS#7 SignedData structures.

    This builder provides a fluent API for constructing digitally signed data structures. It supports multiple signers, attached/detached signatures, certificate chains, CRLs, and timestamping. The builder handles the complexity of assembling all required components and calculating signatures.

    // Create attached signature (content included)
    const signedData = await new SignedDataBuilder()
    .setData('Hello, World!')
    .addSigner({
    privateKeyInfo: signerPrivateKey,
    certificate: signerCert
    })
    .addCertificate(caCert)
    .build()

    // Create detached signature (content separate)
    const detachedSignature = await new SignedDataBuilder()
    .setData(documentBytes)
    .setDetached(true)
    .addSigner({
    privateKeyInfo: signerPrivateKey,
    certificate: signerCert,
    tsa: { url: 'http://timestamp.example.com' }
    })
    .build()

    // Multiple signers with custom attributes
    const multiSigned = await new SignedDataBuilder()
    .setData(data)
    .addSigner({
    privateKeyInfo: signer1Key,
    certificate: signer1Cert,
    signedAttrs: [signingTimeAttr]
    })
    .addSigner({
    privateKeyInfo: signer2Key,
    certificate: signer2Cert
    })
    .build()

    Implements

    Index

    Constructors

    Properties

    additionalCertificates: CertificateChoices[] = []

    Additional certificates to include (e.g., CA certificates).

    contentType: ObjectIdentifier = ...

    Content type identifier for the data being signed.

    Certificate Revocation Lists to include.

    data?: Uint8Array<ArrayBufferLike>

    The data to be signed (optional for detached signatures).

    detached: (detached?: boolean) => SignedDataBuilder = ...

    Alias for setDetached for more fluent API.

    Type Declaration

      • (detached?: boolean): SignedDataBuilder
      • Configures whether to create a detached signature.

        Parameters

        • detached: boolean = true

          true for detached, false for attached (default: true)

        Returns SignedDataBuilder

        This builder instance for chaining

    isDetached: boolean = false

    Whether to create a detached signature (data not included).

    signers: SignedDataBuilderSigner[] = []

    Array of signers to include in the SignedData.

    Accessors

    Methods