Method: HexaPDF::Encryption::StandardSecurityHandler::EncryptionOptions#initialize
- Defined in:
- lib/hexapdf/encryption/standard_security_handler.rb
#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 |