I'm making a program that will let you access a system via encrypted code from a USB. But I can't seem to figure out how I would go about making the user login to the computer via USB. I'll add the code in the code so far.

/*
This is a secure USB keycode app
Written by TheProgrammingPenguin
*/
//TODO: Make program that reads and writes encrypted code to/from USB
import java.util.*;
import java.sql.*;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
// Connect to a database
Connection con = DriverManager.getConnection(/*This will be the connection when the database is up*/);
public class startApp {
    static int createKeycode() {
        System.out.println("Enter your name:");
        Scanner usersName = new Scanner(System.in);
        System.out.print("Enter some random numbers");
        Scanner numbers = new Scanner(System.in);
        // Generate code
        userCode = numbers;
        // Create query to give to database
        String query = "Update Users ** %d;" usersName;
        String query1 = "Update userCodes %d ** %d" usersName, userCode;
        con.executeQuery(query);
        con.executeQuery(query1);
    }
    static int writeToUsb(userCode) {
        // Encrypt code
        int newUserCode = userCode * 500;
        // Open file
        file inputStream - new FileOutputStream("code.txt");
        List<String> lines = text.readTextFile(inputStream);
        // Add code to file
        lines.add(newUserCode);
    }
    static int readFromUsb() {
        // Get file path
        path = file_path;
        // Read file
        FileReader readFromUsb = new FileReader(path);
        // Verify the code through the database
        int verify = readFromUsb.readAllLines();
        int verification = verify / 500;
        databaseVerify = con.executeQuery("SELECT ** from userCodes, %d;" verification);
        if(databaseVerify.hasNextLine){
            new login();
        }
        else {
            System.out.println("Access denied.");
        }
    }
    public static void main(String[] args) {
        System.out.print("What would you like to do?");
        Scanner userAction = new Scanner(System.in);
        new starApp(userAction);
    }
}

Unless you embed it into the OS. I just figured it out. So I just solved my own question.

LOL

I just figured it out. So I just solved my own question.

Guess which question about you I just solved? I now know you were telling the truth there. You did only spend half an hour learning Java.

It shows.

Lol. The code works.

Edited 1 Year Ago by happygeek: keep it pleasant - insult deleted

@Jack, show some respect. We all know you lied about yourself, no need to continue with it. You solved your code issue, good. No need to tell someone to "stfu" because he was right about something. And please, post carefully... you will just dig bigger holes.

Well, unless jack clark is your fake name and is trying to cover up your mistakes of your last account or you're the same jack clark who was one of the most feared right handed batter in the eighties trying to learn programming... who knows who you really are... I am guessing your next move is to make a fake linkedin or facebook and say, "see, its really me!"

Isn't it funny how a person from nasa is asks for help on a forum instead of his many colleagues about his algorithm...

Edited 1 Year Ago by <M/>

This question has already been answered. Start a new discussion instead.