# File lib/net/ssh/authentication/key_manager.rb, line 93
        def each_identity
          if agent
            agent.identities.each do |key|
              known_identities[key] = { :from => :agent }
              yield key
            end
          end
          
          key_files.each do |file|
            public_key_file = file + ".pub"
            if File.readable?(public_key_file)
              begin
                key = KeyFactory.load_public_key(public_key_file)
                known_identities[key] = { :from => :file, :file => file }
                yield key
              rescue Exception => e
                error { "could not load public key file `#{public_key_file}': #{e.class} (#{e.message})" }
              end
            elsif File.readable?(file)
              begin
                private_key = KeyFactory.load_private_key(file, options[:passphrase])
                key = private_key.send(:public_key)
                known_identities[key] = { :from => :file, :file => file, :key => private_key }
                yield key
              rescue Exception => e
                error { "could not load private key file `#{file}': #{e.class} (#{e.message})" }
              end
            end
          end

          key_data.each do |data|
            private_key = KeyFactory.load_data_private_key(data)
            key = private_key.send(:public_key)
            known_identities[key] = { :from => :key_data, :data => data, :key => private_key }
            yield key
          end

          self
        end