Class: Origami::Encryption::EncryptionDictionary

Inherits:
Dictionary
  • Object
show all
Includes:
StandardObject
Defined in:
lib/origami/encryption.rb

Overview

Common class for encryption dictionaries.

Direct Known Subclasses

Standard::Dictionary

Constant Summary

Constants included from StandardObject

StandardObject::DEFAULT_ATTRIBUTES

Constants inherited from Dictionary

Dictionary::TOKENS

Constants included from Object

Object::TOKENS

Instance Attribute Summary

Attributes included from ObjectCache

#names_cache, #strings_cache, #xref_cache

Attributes included from Object

#file_offset, #generation, #no, #objstm_offset, #parent

Instance Method Summary collapse

Methods included from StandardObject

included, #pre_build, #version_required

Methods inherited from Dictionary

#[], #[]=, hint_type, #initialize, #merge, parse, #to_h, #to_obfuscated_str, #to_s, #transform_values, #transform_values!

Methods included from TypeGuessing

#guess_type

Methods included from FieldAccessor

#method_missing, #respond_to_missing?

Methods included from CompoundObject

#copy, #delete, #include?, #update_values, #update_values!

Methods included from ObjectCache

#initialize, #rebuild_caches

Methods included from Object

#cast_to, #copy, #document, #export, included, #indirect?, #indirect_parent, #initialize, #logicalize, #logicalize!, #native_type, #numbered?, parse, #post_build, #pre_build, #reference, #set_document, #set_indirect, skip_until_next_obj, #solve, #to_o, #to_s, #type, typeof, #version_required, #xrefs

Constructor Details

This class inherits a constructor from Origami::Dictionary

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Origami::FieldAccessor

Instance Method Details

#encryption_cipher(name) ⇒ Object

Returns the encryption cipher corresponding to a crypt filter name.



686
687
688
689
690
691
692
693
694
695
696
697
# File 'lib/origami/encryption.rb', line 686

def encryption_cipher(name)
    case self.V.to_i
    when 1, 2
        Encryption::RC4
    when 4, 5
        return Encryption::Identity if name == :Identity

        select_cipher_by_name(name)
    else
        raise EncryptionNotSupportedError, "Unsupported encryption version: #{handler.V}"
    end
end

#stream_encryption_cipherObject

Returns the default stream encryption cipher.



679
680
681
# File 'lib/origami/encryption.rb', line 679

def stream_encryption_cipher
    encryption_cipher(self.StmF || :Identity)
end

#string_encryption_cipherObject

Returns the default string encryption cipher.



672
673
674
# File 'lib/origami/encryption.rb', line 672

def string_encryption_cipher
    encryption_cipher(self.StrF || :Identity)
end