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, #source

Instance Method Summary collapse

Methods inherited from StreamData

#==

Constructor Details

#initialize(obj, key, algorithm, &error_block) ⇒ EncryptedStreamData

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

[View source]

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

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

Instance Attribute Details

#algorithmObject (readonly)

The encryption algorithm.


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

def algorithm
  @algorithm
end

#keyObject (readonly)

The encryption key.


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

def key
  @key
end

Instance Method Details

#fiber(*args) ⇒ Object

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

[View source]

166
167
168
# File 'lib/hexapdf/encryption/security_handler.rb', line 166

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

#undecrypted_fiberObject

[View source]

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

alias undecrypted_fiber fiber