Class: HexaPDF::Encryption::SecurityHandler::EncryptedStreamData

Inherits:
StreamData
  • Object
show all
Defined in:
lib/hexapdf/encryption/security_handler.rb

Overview

Provides additional encryption specific information for HexaPDF::StreamData objects.

Instance Attribute Summary collapse

Attributes inherited from StreamData

#decode_parms, #filter

Instance Method Summary collapse

Methods inherited from StreamData

#==

Constructor Details

#initialize(obj, key, algorithm) ⇒ EncryptedStreamData

Creates a new encrypted stream data object by utilizing the given stream data object as template. The arguments key and algorithm are used for decrypting purposes.



149
150
151
152
153
# File 'lib/hexapdf/encryption/security_handler.rb', line 149

def initialize(obj, key, algorithm)
  obj.instance_variables.each {|v| instance_variable_set(v, obj.instance_variable_get(v)) }
  @key = key
  @algorithm = algorithm
end

Instance Attribute Details

#algorithmObject (readonly)

The encryption algorithm.



145
146
147
# File 'lib/hexapdf/encryption/security_handler.rb', line 145

def algorithm
  @algorithm
end

#keyObject (readonly)

The encryption key.



142
143
144
# File 'lib/hexapdf/encryption/security_handler.rb', line 142

def key
  @key
end

Instance Method Details

#fiber(*args) ⇒ Object

Returns a fiber like HexaPDF::StreamData#fiber, but one wrapped in a decrypting fiber.



158
159
160
# File 'lib/hexapdf/encryption/security_handler.rb', line 158

def fiber(*args)
  @algorithm.decryption_fiber(@key, super(*args))
end

#undecrypted_fiberObject



155
# File 'lib/hexapdf/encryption/security_handler.rb', line 155

alias undecrypted_fiber fiber