phpdftk API Documentation

PdfDecryptor
in package

FinalYes

Decrypts PDF objects using the Standard security handler.

Supports:

  • V=1 R=2: RC4 40-bit
  • V=2 R=3: RC4 variable length (40-128 bit)
  • V=4 R=4: AES-128 or RC4-128 via crypt filters
  • V=5 R=6: AES-256 via crypt filters

Table of Contents

Methods

decryptObject()  : Serializable
Decrypt all string and stream values within a parsed object.
fromEncryptDict()  : self
Build a decryptor from the trailer's /Encrypt dictionary and a password.
fromEncryptDictPublicKey()  : self
Build a decryptor from a public-key (Adobe.PubSec) encrypt dictionary.

Methods

decryptObject()

Decrypt all string and stream values within a parsed object.

public decryptObject(Serializable $object, int $objNum, int $genNum) : Serializable

The /Encrypt dictionary itself must NOT be decrypted.

Parameters
$object : Serializable
$objNum : int
$genNum : int
Return values
Serializable

fromEncryptDict()

Build a decryptor from the trailer's /Encrypt dictionary and a password.

public static fromEncryptDict(PdfDictionary $encryptDict, string $password, string $fileId) : self

Tries the password as the user password first, then as the owner password.

Parameters
$encryptDict : PdfDictionary
$password : string
$fileId : string
Tags
throws
InvalidPdfException

If the password is wrong or the encryption is unsupported

Return values
self

fromEncryptDictPublicKey()

Build a decryptor from a public-key (Adobe.PubSec) encrypt dictionary.

public static fromEncryptDictPublicKey(PdfDictionary $encryptDict, string $certPem, string $privateKeyPem, string $fileId) : self

Extracts the PKCS#7 envelopes from the crypt filter's /Recipients, decrypts the seed using the provided certificate and private key, then derives the file encryption key.

Parameters
$encryptDict : PdfDictionary
$certPem : string
$privateKeyPem : string
$fileId : string
Tags
throws
InvalidPdfException

If no matching recipient found or encryption unsupported

Return values
self

        
On this page

Search results