SetaPDF_Core_SecHandler Main class for PDF security handlers
File: /SetaPDF v2/Core/SecHandler.php
Class hierarchy
Summary
Constants
AES
Encryption constant
AES_128
Encryption constant
AES_256
Encryption constant
ARCFOUR
Encryption constant
ARCFOUR_128
Encryption constant
ARCFOUR_40
Encryption constant
OWNER
Owner auth mode
PERM_ACCESSIBILITY
Permission constant.
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
Permission constant.
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
Permission constant.
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
Permission constant.
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
Permission constant.
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
Permission constant.
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
Permission constant.
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
Permission constant.
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
Public Key Security Handler
STANDARD
Standard Security Handler
USER
User auth mode
Static Properties
Static Methods
arcfour()
Encrypts or decrypts data using the RC4/Arcfour algorithm.
Parameters
- $key : string
- $data : string
checkPermission()
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
generateRandomBytes()
Generate random bytes.
Internally the method tries to use PHPs internal available methods for pseudo-random bytes creation: random_bytes(), openssl_random_pseudo_bytes(). If none of these methods is available a random string is generated by using mt_rand().
Parameters
- $length : int
Exceptions
Throws SetaPDF_Core_SecHandler_Exception
Throws Exception