Table of contents
Namespace: Com\Tecnick\Pdf\Encrypt\Type
File: RCFour.php line 36
RC4 is the standard encryption algorithm used in PDF format
Tags
- since: 2011-05-23
- category: Library
- author: Nicola Asuni info@tecnick.com
- copyright: 2011-2026 Nicola Asuni - Tecnick.com LTD
- license: https://www.gnu.org/copyleft/lesser.html GNU-LGPL v3 (see LICENSE)
- link: https://github.com/tecnickcom/tc-lib-pdf-encrypt
Constants
VALID_CIPHERS
File: RCFour.php line 46
public array<string|int, string> VALID_CIPHERS = ['RC4', 'RC4-40']
The name is validated but does not select an implementation: encrypt() always uses the bundled rc4().
Methods
encrypt()
File: RCFour.php line 75
public encrypt(string $data, string $key[, string $mode = '' ]) : string
RC4 is cryptographically broken; use AES instead.
The cipher is always applied by the bundled implementation: OpenSSL 3 removed RC4 from the default provider, and its fixed key lengths do not match the variable-length object keys of ISO 32000-1 Algorithm 1.
Parameters
- $data : string: Data string to encrypt
- $key : string: Encryption key
- $mode : string = ‘’: Cipher name; validated against VALID_CIPHERS but does not select an implementation
Tags
- throws: Exception
Return values
string —
encrypted text