setasign\FpdiPdfParser\PdfParser\SecHandler

SecHandler An abstract SecHandler class

File: /FPDI PDF-Parser v2/PdfParser/SecHandler/SecHandler.php

Class hierarchy

Summary

Constants

AES

public const int SecHandler::AES = 32

Encryption constant

AES_128

public const int SecHandler::AES_128 = 96

Encryption constant

AES_256

public const int SecHandler::AES_256 = 160

Encryption constant

ARCFOUR

public const int SecHandler::ARCFOUR = 4

Encryption constant

OWNER

public const string SecHandler::OWNER = 'owner'

Owner auth mode

USER

public const string SecHandler::USER = 'user'

User auth mode


Properties

$auth

protected boolean SecHandler::$auth = false

Defines if this security handler is authenticated

$authMode

protected string|null SecHandler::$authMode

The auth mode

Says who is authenticated: user or owner

$encryptionDictionary

protected \setasign\Fpdi\PdfParser\Type\PdfDictionary SecHandler::$encryptionDictionary

The encryption dictionary

$encryptionKey

protected string SecHandler::$encryptionKey

The encryption key

$keyLength

protected int SecHandler::$keyLength = 5

The default key length in bytes

$streamAlgorithm

protected array SecHandler::$streamAlgorithm = array(...)

The algorithm and key length to be used for decrypting streams

$stringAlgorithm

protected array SecHandler::$stringAlgorithm = array(...)

The algorithm and key length to be used for decrypting strings


Static Methods

aesDecrypt()

public static SecHandler::aesDecrypt (
string $key, string $data [, string $bits = '128' ]
): string
Parameters
$key : string
 
$data : string
 
$bits : string
 

arcfour()

public static SecHandler::arcfour (
string $key, string $data
): string
Parameters
$key : string
 
$data : string
 
Exceptions

Throws SecHandlerException

checkCipherSupport()

public static SecHandler::checkCipherSupport (
string $cipher
): bool
Parameters
$cipher : string
 
Exceptions

Throws SecHandlerException

factory()

public static SecHandler::factory (
\setasign\FpdiPdfParser\PdfParser\PdfParser $parser, \setasign\Fpdi\PdfParser\Type\PdfDictionary $encryptionDictionary
): Standard
Parameters
$parser : \setasign\FpdiPdfParser\PdfParser\PdfParser
 
$encryptionDictionary : \setasign\Fpdi\PdfParser\Type\PdfDictionary
 
Exceptions

Throws \setasign\Fpdi\PdfParser\PdfParserException

Throws \setasign\Fpdi\PdfParser\Type\PdfTypeException

Throws SecHandlerException

Throws \setasign\Fpdi\PdfParser\CrossReference\CrossReferenceException


Methods

__construct()

protected SecHandler::__construct (
\setasign\FpdiPdfParser\PdfParser\PdfParser $parser, \setasign\Fpdi\PdfParser\Type\PdfDictionary $encryptionDictionary
)
Parameters
$parser : \setasign\FpdiPdfParser\PdfParser\PdfParser
 
$encryptionDictionary : \setasign\Fpdi\PdfParser\Type\PdfDictionary
 
Exceptions

Throws \setasign\Fpdi\PdfParser\Type\PdfTypeException

Throws SecHandlerException

Throws \setasign\Fpdi\PdfParser\CrossReference\CrossReferenceException

Throws \setasign\Fpdi\PdfParser\PdfParserException

auth()

abstract public SecHandler::auth (
void
): boolean

computeHashR6()

protected SecHandler::computeHashR6 (
string $data, string $inputPassword [, string $userKey = '' ]
): string
Parameters
$data : string
 
$inputPassword : string
 
$userKey : string
 

decrypt()

protected SecHandler::decrypt (
string $data, array $algorithm, int $objectNumber, int $generationNumber
): string
Parameters
$data : string
 
$algorithm : array
 
$objectNumber : int
 
$generationNumber : int
 
Exceptions

Throws SecHandlerException

decryptStream()

public SecHandler::decryptStream (
string $data, int $objectNumber, int $generationNumber
): string
Parameters
$data : string
 
$objectNumber : int
 
$generationNumber : int
 
Exceptions

Throws SecHandlerException

decryptString()

public SecHandler::decryptString (
string $data, int $objectNumber, int $generationNumber
): string
Parameters
$data : string
 
$objectNumber : int
 
$generationNumber : int
 
Exceptions

Throws SecHandlerException

getAuthMode()

public SecHandler::getAuthMode (
void
): string|null

Get the authentication mode (user or owner)

getEncryptionDictionary()

public SecHandler::getEncryptionDictionary (
void
): \setasign\Fpdi\PdfParser\Type\PdfDictionary

isAuth()

public SecHandler::isAuth (
void
): bool

Checks for authentication and tries to authenticate without arguments through the auth() method.

isMetadataEncrypted()

public SecHandler::isMetadataEncrypted (
void
): boolean

Checks whether metadata is encrypted or not.

Exceptions

Throws \setasign\Fpdi\PdfParser\Type\PdfTypeException