13: def verify(arguments)
14: options = arguments[:session].options
15: host = options[:host_key_alias] || arguments[:session].host_as_string
16: matches = Net::SSH::KnownHosts.search_for(host, arguments[:session].options)
17:
18:
19:
20:
21:
22:
23: if matches.empty?
24: ip = arguments[:session].peer[:ip]
25: Net::SSH::KnownHosts.add(host, arguments[:key], arguments[:session].options)
26: return true
27: end
28:
29:
30:
31: found = matches.any? do |key|
32: key.ssh_type == arguments[:key].ssh_type &&
33: key.to_blob == arguments[:key].to_blob
34: end
35:
36:
37:
38: found || process_cache_miss(host, arguments)
39: end