Class: Minke::Encryption::KeyLocator
- Inherits:
-
Object
- Object
- Minke::Encryption::KeyLocator
- Defined in:
- lib/minke/encryption/key_locator.rb
Instance Method Summary collapse
-
#initialize(key_store_path) ⇒ KeyLocator
constructor
A new instance of KeyLocator.
- #locate_key(fingerprint) ⇒ Object
Constructor Details
#initialize(key_store_path) ⇒ KeyLocator
Returns a new instance of KeyLocator.
4 5 6 |
# File 'lib/minke/encryption/key_locator.rb', line 4 def initialize(key_store_path) @key_store_path = key_store_path end |
Instance Method Details
#locate_key(fingerprint) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/minke/encryption/key_locator.rb', line 8 def locate_key fingerprint Dir.entries(@key_store_path).each do |f| begin full_path = "#{@key_store_path}/#{f}" key = SSHKey.new(File.read(full_path)) return full_path if key.fingerprint == fingerprint rescue end end return nil end |