SetaPDF_Core_SecHandler_Standard_Aes256R5 Generator class for AES 256 bit security handler (revision 5 - DEPRECTAED IN ISO/DIS 32000-2)
File: /SetaPDF v2/Core/SecHandler/Standard/Aes256R5.php
Class hierarchy
Implements
Summary
Methods
- __construct()
- _authByOwnerPassword()
- _authByUserPassword()
- _computeEncryptionKey()
- _computeHashR6()
- _computeOValue()
- _computeUValue()
- _crypt()
- _getEncryptionKeyByUserPassword()
- auth()
- authByOwnerPassword()
- authByUserPassword()
- decryptStream()
- decryptString()
- encryptStream()
- encryptString()
- getAuthMode()
- getDocument()
- getEncryptMetadata()
- getEncryptionDictionary()
- getEncryptionKey()
- getPdfVersion()
- getPermission()
- getPermissions()
- getRevision()
- getStreamAlgorithm()
- getStringAlgorithm()
- isAuth()
Static Properties
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
ensurePasswordEncoding()
This method ensures the correct encoding of a password.
Internally the password is converted into the required encoding for the desired revision and it is pocessed with the SASLprep profile if requried.
Parameters
- $revision
- $password
- $encoding
Exceptions
factory()
Factory method for AES 256 bit security handler. (revision 5 - DEPRECTAED IN ISO/DIS 32000-2)
Parameters
- $document : SetaPDF_Core_Document
- $ownerPassword
The owner password in encoding defined in $passwordsEncoding
- $userPassword
The user password in encoding defined in $passwordsEncoding
- $permissions
- $encryptMetadata
- $passwordsEncoding
Exceptions
Methods
__construct()
The constructor.
Parameters
- $document : SetaPDF_Core_Document
- $encryptionDictionary : SetaPDF_Core_Type_Dictionary
Exceptions
_authByOwnerPassword()
Internal method to authenticate with the owner password.
Parameters
- $ownerPassword
Return Values
The encryption key if the authentication was successful.
False if not.
Exceptions
_authByUserPassword()
Internal method to authenticate with the user password.
Parameters
- $userPassword
Return Values
The encryption key if the authentication was successful.
False if not.
_computeEncryptionKey()
Compute the encryption key based on a password.
Parameters
- $password
Exceptions
_computeHashR6()
Computes a hash for security handler revision 6.
Parameters
- $data
- $inputPassword
- $userKey
_computeOValue()
Compute the O value.
Parameters
- $userPassword
- $ownerPassword
Exceptions
_crypt()
Encrypts or decrypts data using Algorithm 1 of the PDF specification.
Parameters
- $data
- $algorithm
- $param
- $encrypt
Exceptions
auth()
Authenticate against the security handler.
This method will try to auth first with the owner password.
If this will fail it will try to auth to the user password.
Parameters
- $password
- $encoding
Return Values
Authentication was successful or not
Exceptions
getAuthMode()
Get the auth method.
Return Values
"user", "owner" or an empty string if not authenticated.
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.