Class: EncryptionKeyItem
- Inherits:
-
Object
- Object
- EncryptionKeyItem
- Defined in:
- lib/encryption_key.rb
Instance Attribute Summary collapse
-
#decrypted_master_key ⇒ Object
readonly
Returns the value of attribute decrypted_master_key.
-
#identifier ⇒ Object
readonly
Returns the value of attribute identifier.
Instance Method Summary collapse
-
#initialize(hash_) ⇒ EncryptionKeyItem
constructor
A new instance of EncryptionKeyItem.
- #unlock(password) ⇒ Object
Constructor Details
#initialize(hash_) ⇒ EncryptionKeyItem
Returns a new instance of EncryptionKeyItem.
22 23 24 |
# File 'lib/encryption_key.rb', line 22 def initialize(hash_) @identifier, @data, @validation, @iterations = hash_.values_at("identifier", "data", "validation", "iterations") end |
Instance Attribute Details
#decrypted_master_key ⇒ Object (readonly)
Returns the value of attribute decrypted_master_key.
20 21 22 |
# File 'lib/encryption_key.rb', line 20 def decrypted_master_key @decrypted_master_key end |
#identifier ⇒ Object (readonly)
Returns the value of attribute identifier.
20 21 22 |
# File 'lib/encryption_key.rb', line 20 def identifier @identifier end |
Instance Method Details
#unlock(password) ⇒ Object
26 27 28 29 30 31 |
# File 'lib/encryption_key.rb', line 26 def unlock(password) @decrypted_master_key = Decrypt.decrypt_pbkdf2(password, @data, @iterations) return false unless @decrypted_master_key validation_key = Decrypt.decrypt_ssl(@decrypted_master_key, @validation) @decrypted_master_key == validation_key end |