Class: HexaPDF::Encryption::StandardSecurityHandler::EncryptionOptions
- Inherits:
-
Object
- Object
- HexaPDF::Encryption::StandardSecurityHandler::EncryptionOptions
- Defined in:
- lib/hexapdf/encryption/standard_security_handler.rb
Overview
Defines all possible options that can be passed to a StandardSecurityHandler when setting up encryption.
Instance Attribute Summary collapse
-
#algorithm ⇒ Object
The encryption algorithm.
-
#encrypt_metadata ⇒ Object
Specifies whether metadata should be encrypted.
-
#owner_password ⇒ Object
The owner password.
-
#permissions ⇒ Object
The permissions.
-
#user_password ⇒ Object
The user password.
Instance Method Summary collapse
-
#initialize(data = {}) ⇒ EncryptionOptions
constructor
:nodoc:.
Constructor Details
#initialize(data = {}) ⇒ EncryptionOptions
:nodoc:
197 198 199 200 201 202 203 204 205 206 207 |
# File 'lib/hexapdf/encryption/standard_security_handler.rb', line 197 def initialize(data = {}) fallback_pwd = data.delete(:password) { '' } @user_password = data.delete(:user_password) { fallback_pwd } @owner_password = data.delete(:owner_password) { fallback_pwd } @permissions = (data.delete(:permissions) { Permissions::ALL }) @algorithm = data.delete(:algorithm) { :arc4 } @encrypt_metadata = data.delete(:encrypt_metadata) { true } if data.size > 0 raise ArgumentError, "Invalid encryption options: #{data.keys.join(', ')}" end end |
Instance Attribute Details
#algorithm ⇒ Object
The encryption algorithm.
191 192 193 |
# File 'lib/hexapdf/encryption/standard_security_handler.rb', line 191 def algorithm @algorithm end |
#encrypt_metadata ⇒ Object
Specifies whether metadata should be encrypted.
194 195 196 |
# File 'lib/hexapdf/encryption/standard_security_handler.rb', line 194 def @encrypt_metadata end |
#owner_password ⇒ Object
The owner password. If this attribute is not specified but the virtual password
attribute is, then the latter is used.
182 183 184 |
# File 'lib/hexapdf/encryption/standard_security_handler.rb', line 182 def owner_password @owner_password end |
#permissions ⇒ Object
The permissions. Either an integer with the needed permission bits set or an array of permission symbols.
See: Permissions
188 189 190 |
# File 'lib/hexapdf/encryption/standard_security_handler.rb', line 188 def @permissions end |
#user_password ⇒ Object
The user password. If this attribute is not specified but the virtual password
attribute is, then the latter is used.
178 179 180 |
# File 'lib/hexapdf/encryption/standard_security_handler.rb', line 178 def user_password @user_password end |