setasign\SetaPDF2\Core\SecHandler
AbstractHandler Abstract security handler class for handling PDF encryption features.
File: /SetaPDF v2/Core/SecHandler/AbstractHandler.php
Old class name (alias):
\SetaPDF_Core_SecHandler_AbstractHandler
Class hierarchy
Summary
Properties
$_authMode
The auth mode
Says who is authenticated: user or owner
$_document
The document to which this security handler is attached
$_encryptionKey
The encryption key
$_keyLength
The key length in bytes
This value is still needed if crypt filters are in use:
- It is needed to compute the encryption key.
- It is needed to compute the O value It is NOT documented which key length should be used for this things if a crypt filter is in use.
Methods
__construct()
The constructor.
Parameters
- $document : \SetaPDF_Core_Document
- $encryptionDictionary : \SetaPDF_Core_Type_Dictionary
Exceptions
Throws Exception
_computeHashR6()
string $inputPassword,
string $userKey = ''
Computes a hash for security handler revision 6.
Parameters
- $data : string
- $inputPassword : string
- $userKey : string
_crypt()
array $algorithm,
\SetaPDF_Core_Type_IndirectObject $param = null,
bool $encrypt = true
Encrypts or decrypts data using Algorithm 1 of the PDF specification.
Parameters
- $data : string
- $algorithm : array
- $param : \SetaPDF_Core_Type_IndirectObject
- $encrypt : bool
Exceptions
Throws Exception
decryptStream()
Decrypt a stream.
Parameters
- $data : string
- $param : \SetaPDF_Core_Type_IndirectObject
Exceptions
Throws Exception
decryptString()
Decrypt a string.
Parameters
- $data : string
- $param : \SetaPDF_Core_Type_IndirectObject
Exceptions
Throws Exception
encryptStream()
Encrypt a stream.
Parameters
- $data : string
- $param : \SetaPDF_Core_Type_IndirectObject
Exceptions
Throws Exception
encryptString()
Encrypt a string.
Parameters
- $data : string
- $param : \SetaPDF_Core_Type_IndirectObject
Exceptions
Throws Exception
getAuthMode()
Get the auth method.
Return Values
"user", "owner" or an empty string if not authenticated.
getEncryptionKey()
getPdfVersion()
Get the PDF version, which is needed for the currently used encryption algorithm.
Exceptions
isAuth()
Queries if the security handler is authenticated.
If not it tries by calling auth() without a password.