class Net::SSH::Authentication::KeyManager

def each_identity

key_data.
from ssh-agent will be ignored unless it present in key_files or
If key manager was created with :keys_only option, any identity

first in the array, with other identities coming after.
ssh-agent. Note that identities from an ssh-agent are always listed
The origin of the identities may be from files on disk or from an
manager. As it finds one, it will then yield it to the caller.
Iterates over all available identities (public keys) known to this
def each_identity
  prepared_identities = prepare_identities_from_files + prepare_identities_from_data
  user_identities = load_identities(prepared_identities, false, true)
  if agent
    agent.identities.each do |key|
      corresponding_user_identity = user_identities.detect { |identity|
        identity[:public_key] && identity[:public_key].to_pem == key.to_pem
      }
      user_identities.delete(corresponding_user_identity) if corresponding_user_identity
      if !options[:keys_only] || corresponding_user_identity
        known_identities[key] = { :from => :agent }
        yield key
      end
    end
  end
  user_identities = load_identities(user_identities, !options[:non_interactive], false)
  user_identities.each do |identity|
    key = identity.delete(:public_key)
    known_identities[key] = identity
    yield key
  end
  self
end