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

    Builder class for creating PKCS#7 EncryptedData structures.

    Provides a fluent API for encrypting data. By default uses PBES2 (PBKDF2 + AES-256-CBC), but can accept custom algorithms via setAlgorithm().

    // Using default PBES2 algorithm
    const encryptedData = await EncryptedData.builder()
    .setContentType('DATA')
    .setData(contentBytes)
    .setPassword('secret')
    .setIterations(2048)
    .build()

    // Using custom algorithm
    const customEncrypted = await EncryptedData.builder()
    .setContentType('DATA')
    .setData(contentBytes)
    .setPassword('secret')
    .setAlgorithm({
    type: 'AES_256_GCM',
    params: { nonce: randomIV }
    })
    .build()

    Implements

    Index

    Constructors

    Methods

    • Sets the content type using a friendly name.

      Parameters

      • type:
            | "DATA"
            | "SIGNED_DATA"
            | "ENVELOPED_DATA"
            | "SIGNED_AND_ENVELOPED_DATA"
            | "DIGESTED_DATA"
            | "ENCRYPTED_DATA"
            | "AUTHENTICATED_DATA"
            | "AUTH_ENVELOPED_DATA"
            | "TST_INFO"

        The content type name

      Returns this

      This builder for chaining