Class: HexaPDF::Encryption::StandardSecurityHandler
- Inherits:
-
SecurityHandler
- Object
- SecurityHandler
- HexaPDF::Encryption::StandardSecurityHandler
- Defined in:
- lib/hexapdf/encryption/standard_security_handler.rb
Overview
The password-based standard security handler of the PDF specification, identified by a /Filter value of /Standard.
Overview
The PDF specification defines one security handler that should be implemented by all PDF conform libraries and applications. This standard security handler allows access permissions and a user password as well as an owner password to be set. See StandardSecurityHandler::EncryptionOptions for all valid options that can be used with this security handler.
The access permissions (see StandardSecurityHandler::Permissions) can be used to restrict what a user is allowed to do with a PDF file.
When a user or owner password is specified, a PDF file can only be opened when the correct password is supplied.
See: PDF1.7 s7.6.3, PDF2.0 s7.6.3
Defined Under Namespace
Modules: Permissions Classes: EncryptionOptions
Instance Attribute Summary
Attributes inherited from SecurityHandler
Instance Method Summary collapse
-
#encryption_key_valid? ⇒ Boolean
Additionally checks that the document trailer’s ID has not changed.
-
#permissions ⇒ Object
Returns the permissions of the managed dictionary as array of symbol values.
Methods inherited from SecurityHandler
#decrypt, #encrypt_stream, #encrypt_string, #initialize, set_up_decryption, #set_up_decryption, set_up_encryption, #set_up_encryption
Constructor Details
This class inherits a constructor from HexaPDF::Encryption::SecurityHandler
Instance Method Details
#encryption_key_valid? ⇒ Boolean
Additionally checks that the document trailer’s ID has not changed.
See: SecurityHandler#encryption_key_valid?
226 227 228 |
# File 'lib/hexapdf/encryption/standard_security_handler.rb', line 226 def encryption_key_valid? super && trailer_id_hash == @trailer_id_hash end |
#permissions ⇒ Object
Returns the permissions of the managed dictionary as array of symbol values.
See: Permissions
233 234 235 236 237 |
# File 'lib/hexapdf/encryption/standard_security_handler.rb', line 233 def Permissions::PERMISSION_TO_SYMBOL.each_with_object([]) do |(perm, sym), result| result << sym if dict[:P] & perm == perm end end |