class Net::SSH::Authentication::KeyManager

def load_identities(identities, ask_passphrase, ignore_decryption_errors)

Load prepared identities. Private key decryption errors ignored if ignore_decryption_errors
def load_identities(identities, ask_passphrase, ignore_decryption_errors)
  identities.map do |identity|
    begin
      case identity[:load_from]
      when :pubkey_file
        key = KeyFactory.load_public_key(identity[:pubkey_file])
        { public_key: key, from: :file, file: identity[:privkey_file] }
      when :privkey_file
        private_key = KeyFactory.load_private_key(identity[:privkey_file], options[:passphrase], ask_passphrase, options[:password_prompt])
        key = private_key.send(:public_key)
        { public_key: key, from: :file, file: identity[:privkey_file], key: private_key }
      when :data
        private_key = KeyFactory.load_data_private_key(identity[:data], options[:passphrase], ask_passphrase, "<key in memory>", options[:password_prompt])
        key = private_key.send(:public_key)
        { public_key: key, from: :key_data, data: identity[:data], key: private_key }
      else
        identity
      end
    rescue OpenSSL::PKey::RSAError, OpenSSL::PKey::DSAError, OpenSSL::PKey::ECError, OpenSSL::PKey::PKeyError, ArgumentError => e
      if ignore_decryption_errors
        identity
      else
        process_identity_loading_error(identity, e)
        nil
      end
    rescue Exception => e
      process_identity_loading_error(identity, e)
      nil
    end
  end.compact
end