class Key
Attributes
encrypted[R]
key_id[R]
Public Class Methods
new(hash_)
click to toggle source
# File lib/key.rb, line 9 def initialize(hash_) @key_id, @encrypted, @type_name, @security_level = hash_.values_at("keyID", "encrypted", "typeName", "securityLevel") @type = types[@type_name] || Password end
Public Instance Methods
decrypt(encryption_key)
click to toggle source
# File lib/key.rb, line 14 def decrypt(encryption_key) encryption_key_item = encryption_key.get(@key_id) || encryption_key.get(@security_level) decrypted_master_key = encryption_key_item.decrypted_master_key return unless decrypted_master_key decrypted_content = JSON.parse Decrypt.decrypt_ssl(decrypted_master_key, @encrypted) @type.new decrypted_content end
types()
click to toggle source
# File lib/key.rb, line 4 def types {"webforms.WebForm" => WebForm, "passwords.Password" => Password} end