SetaPDF_Core_SecHandler_PublicKey_Arcfour128Cf Generator class for RC4 128 bit public-key security handler with crypt filters
File: /SetaPDF v2/Core/SecHandler/PublicKey/Arcfour128Cf.php
Class hierarchy
Implements
Summary
Methods
- __construct()
- _cleanUp()
- _computeEncryptionKey()
- _computeHashR6()
- _crypt()
- _prepareEnvelopes()
- _preparePermission()
- auth()
- decryptStream()
- decryptString()
- encryptStream()
- encryptString()
- getAuthMode()
- getCipherId()
- getDocument()
- getEncryptMetadata()
- getEncryptionDictionary()
- getEncryptionKey()
- getPdfVersion()
- getPermission()
- getPermissions()
- getStreamAlgorithm()
- getStringAlgorithm()
- isAuth()
- setCipherId()
Constants
PERM_OWNER
Permission constant.
When set permits change of encryption and enables all other permissions.
See
- PDF 32000-1:2008 - Table 24 - Public-Key security handler user access permissions
Properties
$_authMode
The auth mode
Says who is authenticated: user or owner
$_encryptionDictionary
The encryption dictionary
$_encryptionKey
The encryption key
$_keyLength
The key length in bytes
This value is still needed if crypt filters are in use:
- It is needed to compute the encryption key.
- It is needed to compute the O value It is NOT documented which key length should be used for this things if a crypt filter is in use.
Static Methods
create()
Create method for RC4 128 bit public-key security handler with crypt filters.
Parameters
- $document : SetaPDF_Core_Document
- $recipients : SetaPDF_Core_SecHandler_PublicKey_Recipient[]|SetaPDF_Core_SecHandler_PublicKey_Recipient
- $encryptMetadata : boolean
Exceptions
Throws Exception
factory()
WARNING: This method is marked as deprecated!
Use self::create() instead
Parameters
- $document : SetaPDF_Core_Document
- $recipients : SetaPDF_Core_SecHandler_PublicKey_Recipient[]|SetaPDF_Core_SecHandler_PublicKey_Recipient
- $encryptMetadata : boolean
Exceptions
Throws Exception
Methods
__construct()
The constructor.
Parameters
- $document : SetaPDF_Core_Document
- $encryptionDictionary : SetaPDF_Core_Type_Dictionary
Exceptions
Throws SetaPDF_Core_SecHandler_Exception
Throws SetaPDF_Core_Type_Exception
_computeEncryptionKey()
Computes the encryption key.
Parameters
- $envelopes : string[]
- $seed : string
- $encryptMetadata : bool|true
_computeHashR6()
Computes a hash for security handler revision 6.
Parameters
- $data : string
- $inputPassword : string
- $userKey : string
_crypt()
Encrypts or decrypts data using Algorithm 1 of the PDF specification.
Parameters
- $data : string
- $algorithm : array
- $param : SetaPDF_Core_Type_IndirectObject
- $encrypt : boolean
Exceptions
_prepareEnvelopes()
Prepares the PKCS#7 envelopes.
Parameters
- $recipients : SetaPDF_Core_SecHandler_PublicKey_Recipient[]
- $seed : string
Exceptions
Throws Exception
auth()
Authenticate to the security handler with a certificate and private key.
Parameters
- $recipientCert : mixed
See parameter $recipcert of openssl_pkcs7_decrypt().
- $recipientKey : mixed
See parameter $recipkey of openssl_pkcs7_decrypt().
Exceptions
Throws SetaPDF_Core_SecHandler_Exception
Throws Exception
decryptStream()
Decrypt a stream.
Parameters
- $data : string
- $param : SetaPDF_Core_Type_IndirectObject
Exceptions
decryptString()
Decrypt a string.
Parameters
- $data : string
- $param : SetaPDF_Core_Type_IndirectObject
Exceptions
encryptStream()
Encrypt a stream.
Parameters
- $data : string
- $param : SetaPDF_Core_Type_IndirectObject
Exceptions
encryptString()
Encrypt a string.
Parameters
- $data : string
- $param : SetaPDF_Core_Type_IndirectObject
Exceptions
getAuthMode()
Get the auth method.
Return Values
"user", "owner" or an empty string if not authenticated.
getEncryptionDictionary()
Gets the encryption dictionary.
getPdfVersion()
Get the PDF version, which is needed for the currently used encryption algorithm.
Exceptions
isAuth()
Queries if the security handler is authenticated.
If not it tries by calling auth() without a password.
setCipherId()
Set the cipher id, that will be passed to openssl_pkcs7_encrypt().
ISO/DIS 32000-2: 7.6.5.3 Public-key encryption algorithms:
The algorithms that shall be used to encrypt the enveloped data in the PKCS#7 object are: RC4 with key lengths up to 256-bits, DES, Triple DES, RC2 with key lengths up to 128 bits, 128-bit AES in Cipher Block Chaining (CBC) mode, 192-bit AES in CBC mode, 256-bit AES in CBC mode.Parameters
- $cipherId : int