Compute extends Data
in package
Com\Tecnick\Pdf\Encrypt\Compute
PHP class to generate encryption data
Tags
Table of Contents
Methods
- encrypt() : string
- Encrypt data using the specified encrypt type.
- escapeString() : string
- Escape a string: add "\" before "\", "(" and ")".
- getEncPermissionsString() : string
- Convert encryption P value to a string of bytes, low-order byte first.
- getObjectKey() : string
- Compute encryption key depending on object number where the encrypted data is stored.
- getPdfEncryptionObj() : string
- Get the PDF encryption block
- getUserPermissionCode() : int
- Return the permission code used on encryption (P value).
Methods
encrypt()
Encrypt data using the specified encrypt type.
public encrypt(int|string|false $type[,
string $data
= ''
][,
string $key
= ''
][,
int $objnum
= 0
]) : string
Parameters
- $type : int|string|false
-
Encrypt type.
- $data : string = ''
-
Data string to encrypt.
- $key : string = ''
-
Encryption key.
- $objnum : int = 0
-
Object number.
Return values
stringescapeString()
Escape a string: add "\" before "\", "(" and ")".
public escapeString(string $str)
: string
Parameters
- $str : string
-
String to escape.
Return values
stringgetEncPermissionsString()
Convert encryption P value to a string of bytes, low-order byte first.
public getEncPermissionsString(int $protection)
: string
Parameters
- $protection : int
-
32bit encryption permission value (P value).
Return values
stringgetObjectKey()
Compute encryption key depending on object number where the encrypted data is stored.
public getObjectKey(int $objnum)
: string
This is used for all strings and streams without crypt filter specifier.
Parameters
- $objnum : int
-
Object number.
Return values
stringgetPdfEncryptionObj()
Get the PDF encryption block
public getPdfEncryptionObj(int &$pon)
: string
Parameters
- $pon : int
-
Current PDF object number
Return values
stringgetUserPermissionCode()
Return the permission code used on encryption (P value).
public getUserPermissionCode(array<string|int,
string> $permissions[,
int $mode
= 0
]) : int
Parameters
- $permissions : array<string|int, string>
-
The set of permissions (specify the ones you want to block).
- $mode : int = 0
-
Encryption strength: 0 = RC4 40 bit; 1 = RC4 128 bit; 2 = AES 128 bit; 3 = AES 256 bit.