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

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.



146
147
148
149
150
# File 'lib/hexapdf/encryption/security_handler.rb', line 146

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.



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

def algorithm
  @algorithm
end

#keyObject (readonly)

The encryption key.



139
140
141
# File 'lib/hexapdf/encryption/security_handler.rb', line 139

def key
  @key
end

Instance Method Details

#fiber(*args) ⇒ Object

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



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

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

#undecrypted_fiberObject



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

alias undecrypted_fiber fiber