classes-Com-Tecnick-Pdf-Encrypt-Compute

It appears that you are using AdBlocking software. The cost of running this website is covered by advertisements. If you like it please feel free to a small amount of money to secure the future of this website.

Compute extends Data

in package

AbstractYes

Com\Tecnick\Pdf\Encrypt\Compute

PHP class to generate encryption data

Tags
since
2008-01-02
category

Library

author

Nicola Asuni info@tecnick.com

copyright

2011-2023 Nicola Asuni - Tecnick.com LTD

license

http://www.gnu.org/copyleft/lesser.html GNU-LGPL v3 (see LICENSE.TXT)

link
https://github.com/tecnickcom/tc-lib-pdf-encrypt
SuppressWarnings

(PHPMD.ExcessiveClassComplexity)

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
string

escapeString()

Escape a string: add "\" before "\", "(" and ")".

public escapeString(string $str) : string
Parameters
$str : string

String to escape.

Return values
string

getEncPermissionsString()

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
string

getObjectKey()

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
string

getPdfEncryptionObj()

Get the PDF encryption block

public getPdfEncryptionObj(int &$pon) : string
Parameters
$pon : int

Current PDF object number

Return values
string

getUserPermissionCode()

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.

Return values
int
On this page
 

© 2004-2024 – Nicola Asuni - Tecnick.com - All rights reserved.
about - disclaimer - privacy