Class: Origami::Encryption::EncryptionDictionary
- Inherits:
-
Dictionary
- Object
- Hash
- Dictionary
- Origami::Encryption::EncryptionDictionary
- Includes:
- StandardObject
- Defined in:
- lib/origami/encryption.rb
Overview
Common class for encryption dictionaries.
Direct Known Subclasses
Constant Summary
Constants included from StandardObject
StandardObject::DEFAULT_ATTRIBUTES
Constants inherited from Dictionary
Constants included from Object
Instance Attribute Summary
Attributes inherited from Dictionary
#names_cache, #strings_cache, #xref_cache
Attributes included from Object
#file_offset, #generation, #no, #objstm_offset, #parent
Instance Method Summary collapse
-
#encryption_cipher(name) ⇒ Object
Returns the encryption cipher corresponding to a crypt filter name.
-
#stream_encryption_cipher ⇒ Object
Returns the default stream encryption cipher.
-
#string_encryption_cipher ⇒ Object
Returns the default string encryption cipher.
Methods included from StandardObject
included, #pre_build, #version_required
Methods inherited from Dictionary
#[], #[]=, add_type_signature, #cast_to, #copy, #delete, guess_type, hint_type, #initialize, #key?, #map!, #merge, parse, #to_h, #to_obfuscated_str, #to_s
Methods included from FieldAccessor
#method_missing, #respond_to_missing?
Methods included from Object
#<=>, #cast_to, #copy, #document, #export, included, #indirect?, #indirect_parent, #initialize, #logicalize, #logicalize!, #native_type, 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.
687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 |
# File 'lib/origami/encryption.rb', line 687 def encryption_cipher(name) case self.V.to_i when 1, 2 Encryption::RC4 when 4, 5 return Encryption::Identity if name == :Identity raise EncryptionError, "Broken CF entry" unless self.CF.is_a?(Dictionary) self.CF.select { |key, dict| key == name and dict.is_a?(Dictionary) } .map { |_, dict| cipher_from_crypt_filter_method(dict[:CFM] || :None) } .first else raise EncryptionNotSupportedError, "Unsupported encryption version: #{handler.V}" end end |
#stream_encryption_cipher ⇒ Object
Returns the default stream encryption cipher.
680 681 682 |
# File 'lib/origami/encryption.rb', line 680 def stream_encryption_cipher encryption_cipher(self.StmF || :Identity) end |
#string_encryption_cipher ⇒ Object
Returns the default string encryption cipher.
673 674 675 |
# File 'lib/origami/encryption.rb', line 673 def string_encryption_cipher encryption_cipher(self.StrF || :Identity) end |