# File lib/net/ssh/known-hosts.rb, line 56 def keys_for(host) keys = [] hosts = Array(host) File.open(source) do |file| scanner = StringScanner.new("") file.each_line do |line| scanner.string = line scanner.skip(/\s*/) next if scanner.match?(/$|#/) hostlist = scanner.scan(/\S+/) next if (hostlist.split(/,/) & hosts).empty? scanner.skip(/\s*/) type = scanner.scan(/\S+/) scanner.skip(/\s*/) blob = scanner.rest.unpack("m*").first keys << Net::SSH::Transport::OSSL::Buffer.new(blob).read_key end end keys rescue SystemCallError return [] end