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);
    }
}

Recommended Answers

All 14 Replies

this will never work. the user must be logged in already with a jvm to run this code in.

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.

@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.

"Lol. The code works."

You are demented. Almost every other line contains an error. It a long way from even compiling.

Who the hell does this guy think he is?

Jack_11 is just some kid who has been wasting our time.

ps: Using the same IP address was bit of as give-away.

What? How are we using the same IP address?

NASA Standard security procedure is too falsify the ip address. Strange how this was the one I ended up with.

Using the same IP address was bit of as give-away.

So was using the same name in your profile :)

What do you mean by same name? Is his name Jack Clark also?

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...

Jack/Perpy is just some loser troll. Ignore him and he will go away. Simples.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.