pdf-lite - v1.0.1
    Preparing search index...

    Class PdfStandardSecurityHandlerAbstract

    Abstract base class for standard PDF security handlers. Implements password-based encryption as defined in the PDF specification.

    const handler = new PdfV5SecurityHandler({
    password: 'user123',
    ownerPassword: 'admin456',
    permissions: { print: true, copy: false }
    })

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    The encryption dictionary containing all encryption parameters.

    documentId?: PdfId

    Document identifier for key derivation.

    encryptMetadata: boolean

    Whether to encrypt document metadata.

    masterKey?: ByteArray

    Derived master encryption key.

    ownerKey?: ByteArray

    Computed owner key (O value).

    ownerPassword?: ByteArray

    Owner password for full access.

    password: ByteArray

    User password for authentication.

    permissions: number

    Numeric permission flags.

    userKey?: ByteArray

    Computed user key (U value).

    Methods

    • Decrypts data using the appropriate cipher.

      Parameters

      • type: "string" | "stream" | "file"

        The type of content being decrypted.

      • data: ByteArray

        The encrypted data.

      • OptionalobjectNumber: number

        The PDF object number.

      • OptionalgenerationNumber: number

        The PDF generation number.

      Returns Promise<ByteArray>

      The decrypted data.

    • Encrypts data using the appropriate cipher.

      Parameters

      • type: "string" | "stream" | "file"

        The type of content being encrypted.

      • data: ByteArray

        The data to encrypt.

      • OptionalobjectNumber: number

        The PDF object number.

      • OptionalgenerationNumber: number

        The PDF generation number.

      Returns Promise<ByteArray>

      The encrypted data.

    • Gets a cipher for the specified object.

      Parameters

      • OptionalobjectNumber: number

        The PDF object number.

      • OptionalgenerationNumber: number

        The PDF generation number.

      Returns Promise<Cipher | null>

      A cipher instance, or null if no encryption needed.

    • Recovers the user password from the owner password.

      Parameters

      • OptionalownerPassword: string | ByteArray

        The owner password.

      Returns Promise<string>

      The recovered user password.

      Error if recovery is not supported.