Class: Key
- Inherits:
-
Object
- Object
- Key
- Defined in:
- lib/key.rb
Instance Attribute Summary collapse
-
#encrypted ⇒ Object
readonly
Returns the value of attribute encrypted.
-
#key_id ⇒ Object
readonly
Returns the value of attribute key_id.
Instance Method Summary collapse
- #decrypt(encryption_key) ⇒ Object
-
#initialize(hash_) ⇒ Key
constructor
A new instance of Key.
- #types ⇒ Object
Constructor Details
Instance Attribute Details
#encrypted ⇒ Object (readonly)
Returns the value of attribute encrypted.
2 3 4 |
# File 'lib/key.rb', line 2 def encrypted @encrypted end |
#key_id ⇒ Object (readonly)
Returns the value of attribute key_id.
2 3 4 |
# File 'lib/key.rb', line 2 def key_id @key_id end |
Instance Method Details
#decrypt(encryption_key) ⇒ Object
14 15 16 17 18 19 20 |
# 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 |