0

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);
    }
}
8
Contributors
14
Replies
81
Views
2 Years
Discussion Span
Last Post by happygeek
Featured Replies
  • 3

    LOL > I just figured it out. So I just solved my own question. Guess which [question](https://www.daniweb.com/software-development/threads/490097/do-i-have-some-sort-of-programming-talent) 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. Read More

  • 2
    <M/> 170   2 Years Ago

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

  • Jack_11 is just some kid who has been wasting our time. ps: Using the same IP address was bit of as give-away. Read More

  • 1

    > Using the same IP address was bit of as give-away. So was using the same name in your profile :) Read More

-1

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

3

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.

-3

Lol. The code works.

Edited by happygeek: keep it pleasant - insult deleted

2

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

1

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

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

1

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

So was using the same name in your profile :)

1

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 by <M/>

This question has already been answered. Start a new discussion instead.
Be sure to adhere to our posting rules.