RCFour

RC4 is the standard encryption algorithm used in PDF format

Namespace: Com\Tecnick\Pdf\Encrypt\Type

class RCFour

Source: src/Type/RCFour.php:36

RC4 is the standard encryption algorithm used in PDF format

Constants

VALID_CIPHERS

Accepted cipher names.

The name is validated but does not select an implementation: encrypt() always uses the bundled rc4().

public const VALID_CIPHERS = ['RC4', 'RC4-40']

Source: src/Type/RCFour.php:46

Methods

encrypt()

Encrypt the data using the RC4 (Rivest Cipher 4, also known as ARC4 or ARCFOUR) algorithm.

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.

public encrypt(string $data, string $key, string $mode = ''): string

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

Returns: string: encrypted text

Throws:

Source: src/Type/RCFour.php:75