Class: OoxmlDecrypt::KeyInfoBase
- Inherits:
-
Object
- Object
- OoxmlDecrypt::KeyInfoBase
- Defined in:
- lib/ooxml_decrypt/key_info_base.rb
Direct Known Subclasses
Class Method Summary collapse
-
.opts_from_xml_node(xml_node) ⇒ Object
Parses options that KeyInfoBase knows about from an XML node.
Instance Method Summary collapse
-
#initialize(opts) ⇒ KeyInfoBase
constructor
A new instance of KeyInfoBase.
Constructor Details
#initialize(opts) ⇒ KeyInfoBase
Returns a new instance of KeyInfoBase.
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/ooxml_decrypt/key_info_base.rb', line 6 def initialize(opts) @block_size = opts.delete(:block_size) @hash_algorithm = opts.delete(:hash_algorithm) @cipher_algorithm = opts.delete(:cipher_algorithm) @key_bits = opts.delete(:key_bits) @cipher_chaining = opts.delete(:cipher_chaining) @salt = opts.delete(:salt) raise "Unknown opts: #{opts.keys.join(',')}" if opts.any? end |
Class Method Details
.opts_from_xml_node(xml_node) ⇒ Object
Parses options that KeyInfoBase knows about from an XML node. (Helper function to be used by initializers in subclasses).
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/ooxml_decrypt/key_info_base.rb', line 20 def self.opts_from_xml_node(xml_node) opts = { :block_size => xml_node["blockSize"].to_i, :hash_algorithm => xml_node["hashAlgorithm"], :cipher_algorithm => xml_node["cipherAlgorithm"], :key_bits => xml_node["keyBits"].to_i, :cipher_chaining => xml_node["cipherChaining"], :salt => xml_node["saltValue"].base64_decode, } end |