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:
212 213 214 215 216 217 218 219 220 221 222 223 |
# File 'lib/hexapdf/encryption/standard_security_handler.rb', line 212 def initialize(data = {}) fallback_pwd = data.delete(:password) { '' } @user_password = data.delete(:user_password) { fallback_pwd } @owner_password = data.delete(:owner_password) { fallback_pwd } @owner_password = @user_password if @owner_password.to_s.empty? @permissions = (data.delete(:permissions) { Permissions::ALL }) @algorithm = data.delete(:algorithm) { :arc4 } @encrypt_metadata = data.delete(:encrypt_metadata) { true } unless data.empty? raise ArgumentError, "Invalid encryption options: #{data.keys.join(', ')}" end end |
Instance Attribute Details
#algorithm ⇒ Object
The encryption algorithm.
206 207 208 |
# File 'lib/hexapdf/encryption/standard_security_handler.rb', line 206 def algorithm @algorithm end |
#encrypt_metadata ⇒ Object
Specifies whether metadata should be encrypted.
209 210 211 |
# File 'lib/hexapdf/encryption/standard_security_handler.rb', line 209 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.
197 198 199 |
# File 'lib/hexapdf/encryption/standard_security_handler.rb', line 197 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
203 204 205 |
# File 'lib/hexapdf/encryption/standard_security_handler.rb', line 203 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.
193 194 195 |
# File 'lib/hexapdf/encryption/standard_security_handler.rb', line 193 def user_password @user_password end |