Module: HexaPDF::Filter::Encryption

Defined in:
lib/hexapdf/filter/encryption.rb

Overview

This filter module allows access to the standard encryption and decryption routines implemented by the SecurityHandler using the standard Filter interface.

The options hash for ::decoder and ::encoder must contain two keys: :key (the encryption/decryption key) and :algorithm (the class used for encrypting/decrypting).

This module must not be confused with the Crypt filter specified in the PDF specification!

Class Method Summary collapse

Class Method Details

.decoder(source, options) ⇒ Object

See HexaPDF::Filter



50
51
52
# File 'lib/hexapdf/filter/encryption.rb', line 50

def self.decoder(source, options)
  options[:algorithm].decryption_fiber(options[:key], source)
end

.encoder(source, options) ⇒ Object

See HexaPDF::Filter



55
56
57
# File 'lib/hexapdf/filter/encryption.rb', line 55

def self.encoder(source, options)
  options[:algorithm].encryption_fiber(options[:key], source)
end