SetaPDF_Core_SecHandler Main class for PDF security handlers

File: /SetaPDF/Core/SecHandler.php

Class hierarchy

Summary

Constants

AES

const string SetaPDF_Core_SecHandler::AES = 32

Encryption constant

AES_128

const string SetaPDF_Core_SecHandler::AES_128 = 96

Encryption constant

AES_256

const string SetaPDF_Core_SecHandler::AES_256 = 160

Encryption constant

ARCFOUR

Encryption constant

ARCFOUR_128

Encryption constant

ARCFOUR_40

Encryption constant

OWNER

const string SetaPDF_Core_SecHandler::OWNER = 'owner'

Owner auth mode

PERM_ACCESSIBILITY

For handlers of revision 3 or greater: Extract text and graphics (in support of accessibility to users with disabilities or for other purposes).

See
  • PDF 32000-1:2008 - Table 22 - User access permissions

PERM_ANNOT

Add or modify text annotations, fill in interactive form fields, and, if SetaPDF_Core_SecHandler::PERM_MODIFY is also set, create or modify interactive form fields (including signature fields).

See
  • PDF 32000-1:2008 - Table 22 - User access permissions

PERM_ASSEMBLE

For handlers of revision 3 or greater: Assemble the document (insert, rotate, or delete pages and create bookmarks or thumbnail images), even if SetaPDF_Core_SecHandler::PERM_MODIFY is not set.

See
  • PDF 32000-1:2008 - Table 22 - User access permissions

PERM_COPY

For handlers of revision 2: Copy or otherwise extract text and graphics from the document, including extracting text and graphics (in support of accessibility to users with disabilities or for other purposes).

For handlers of revision 3 or greater: Copy or otherwise extract text and graphics from the document by operations other than that controlled by bit SetaPDF_Core_SecHandler::PERM_ACCESSIBILITY.

See
  • PDF 32000-1:2008 - Table 22 - User access permissions

PERM_DIGITAL_PRINT

Print the document to a representation from which a faithful digital copy of the PDF content could be generated. When this is not set (and SetaPDF_Core_SecHandler::PERM_PRINT is set), printing is limited to a low-level representation of the appearance, possibly of degraded quality.

See
  • PDF 32000-1:2008 - Table 22 - User access permissions

PERM_FILL_FORM

For handlers of revision 3 or greater: Fill in existing interactive form fields (including signature fields), even if SetaPDF_Core_SecHandler::PERM_ANNOT is not set.

See
  • PDF 32000-1:2008 - Table 22 - User access permissions

PERM_MODIFY

Modify the contents of the document by operations other than those controlled by SetaPDF_Core_SecHandler::PERM_ANNOT, SetaPDF_Core_SecHandler::PERM_FILL_FORM and SetaPDF_Core_SecHandler::PERM_ASSEMBLE.

See
  • PDF 32000-1:2008 - Table 22 - User access permissions

PERM_PRINT

For handlers of revision 2: Print the document.

Handlers of a revision of 3 or greater: Print the document (possibly not at the highest quality level, depending on whether SetaPDF_Core_SecHandler::PERM_DIGITAL_PRINT is also set).

See
  • PDF 32000-1:2008 - Table 22 - User access permissions

PUB_KEY

const string SetaPDF_Core_SecHandler::PUB_KEY = 'publicKey'

Public Key Security Handler

STANDARD

const string SetaPDF_Core_SecHandler::STANDARD = 'standard'

Standard Security Handler

USER

const string SetaPDF_Core_SecHandler::USER = 'user'

User auth mode


Static Properties

$engine

static public string SetaPDF_Core_SecHandler::$engine = 'openssl'

The encryption engine to use (mcrypt or openssl).


Static Methods

aes128Decrypt()

static public string SetaPDF_Core_SecHandler::aes128Decrypt ( string $key, string $data )

Decrypts data using AES 128 bit algorithm.

Parameters
$key : string
 
$data : string
 

aes128Encrypt()

static public string SetaPDF_Core_SecHandler::aes128Encrypt ( string $key, string $data )

Encrypts data using AES 128 bit algorithm.

Parameters
$key : string
 
$data : string
 

aes256Decrypt()

static public string SetaPDF_Core_SecHandler::aes256Decrypt ( string $key, string $data )

Decrypts data using AES 256 bit algorithm.

Parameters
$key : string
 
$data : string
 

aes256Encrypt()

static public string SetaPDF_Core_SecHandler::aes256Encrypt ( string $key, string $data )

Encrypts data using AES 256 bit algorithm.

Parameters
$key : string
 
$data : string
 

arcfour()

static public string SetaPDF_Core_SecHandler::arcfour ( string $key, string $data )

Encrypts or decrypts data using the RC4/Arcfour algorithm.

Parameters
$key : string
 
$data : string
 

checkPermission()

static public bool SetaPDF_Core_SecHandler::checkPermission ( SetaPDF_Core_Document $document, integer $permission [, null|string $message = null ] )

Checks a permission against the security handler of a document.

Parameters
$document : SetaPDF_Core_Document

The document instance

$permission : integer

Permission to check

$message : null|string

Custom error message

Exceptions

Throws SetaPDF_Core_SecHandler_Exception if no rights are granted for the permission.

factory()

Returns a standard predefined security handler.

The type parameter will define things like algorithm and key length. Additionally the type could be an encryption dictionary, which will setup the desired security handler.

Parameters
$document : SetaPDF_Core_Document
 
$encryptionDictionary : SetaPDF_Core_Type_Dictionary
 
Exceptions

Throws SetaPDF_Core_Exception, SetaPDF_Exception_NotImplemented