Class: Minke::Encryption::KeyLocator

Inherits:
Object
  • Object
show all
Defined in:
lib/minke/encryption/key_locator.rb

Instance Method Summary collapse

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