QuestionQuestion

Create an application that uses a socket connection to allow a client to specify a file name of a text file and have the server send the contents of the file or indicate the file does not exist. The server must contain a text based password file ("user name" & "password"). The client must pass a valid username and password to establish a connection with the Server. Needs to use Java Cryptographic Extension

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

public class Passwords {

    private static String bytesToHex(byte[] hash) {
       StringBuffer hexString = new StringBuffer();
       for (int i = 0; i < hash.length; i++) {
            String hex = Integer.toHexString(0xff & hash[i]);
            if(hex.length() == 1) hexString.append('0');
            hexString.append(hex);
       }
       return hexString.toString();
    }

    public static void main(String[] args){

       String[] users = {"user1", "user2", "user3", "user4"};
       String[] passwords = {"abcd", "abc", "xyz", "test"};

       try {
            MessageDigest md = MessageDigest.getInstance("SHA-256");
            PrintWriter writer = new PrintWriter(new File("passwords.txt"));...

By purchasing this solution you'll be able to access the following files:
Solution.java, Solution1.java and Solution2.java.

50% discount

Hours
Minutes
Seconds
$35.00 $17.50
for this solution

or FREE if you
register a new account!

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Java Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats