Skip to content

WiseNN/javaChatDataServer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

javaChatDataServer

This is a Java Server used for intensive CPU Data Manipulation. This is a client server, and will take requests from the API built in the: csc2720_Project repository. All group members responsible for constructing algorithms to aggregate the data model, please clone this repository.

The Following code block is reffering to changes that need to be made in the DataProcessing/Encryption.java file

    Changes:

The caller is going to call your function like this (data types are in arguments):

Encryption op1 = new Encryption();
	HashMap<String , Object> returnValue =	op1.wrapperFunc(String , HashMap<String, Object>);

Example HashMap parameter:

{
   "_id": "WiseN",
   "__v": 4,
   "privateConvos": [
      {
         "recipientId": "TaslimD", (***ENCRYPT ***)
         "_id": "WiseN",
         "__v": 0,
         "messages": [
            {
               "_id": "5a130b5ac9b53d2d73e10952",
               "text": "Hey Whats Up", (***ENCRYPT ***)
               "sender": "WiseN",
               "time": " 12:05:29 GMT-0500 (EST)",
               "date": "October 20, 2017"
            },
            {
               "_id": "5a130c2fc9b53d2d73e10953",
               "text": "Hey, Nothing much, this API has really been kicking my ass", (***ENCRYPT ***)
               "sender": "TaslimD",
               "time": " 12:09:03 GMT-0500 (EST)",
               "date": "October 20, 2017"
            },
            {
               "_id": "5a130c70c9b53d2d73e10954",
               "text": "I bet. This homework as pretty much taken over my life. Im just trying to stay a float lol", (***ENCRYPT ***)
               "sender": "WiseN",
               "time": " 12:10:08 GMT-0500 (EST)",
               "date": "October 20, 2017"
            }
         ]
      }
   ]
}

*** Watch this youtube video on how to process JSON Data in JAVA:
https://www.youtube.com/watch?v=cFCgFlqF5kw ***

  1. Your wrapper function should be able to accept a string parameter, and a HashMap of type HashMap<String, Object>
  2. Write a switch or if statement to handle the request of encrypt or decrypt
  3. You should return a value of type HashMap<String, Object> that looks just like the incoming argument (above)
  4. ALL of the methods inside of your wrapper function should be private and none-accessible outside of the class

DO NOT FOCUS ON, WE WILL REVISIT

  1. Remember the purpose of your algorithm, to encrypt and decrypt data; which means you need to store the key somewhere
  2. When your wrapper function is called to encrypt data, you should encrypt/Salt the array of random numbers, keep the key, and destroy the array of random numbers. IT SHOULD NOT BE STORED IN YOUR PROGRAM
  3. After you have encrypted the Array of random numbers, the salted key to decrypt the array of random numbers should be returned inside of the hashMap under the key "saltedKey"

The library er are using to read and write json objects is called JSON.simple. There are many tutorials and videos on how to use JSON.simple. A simple google search will help you. However, you can start here: https://www.mkyong.com/java/json-simple-example-read-and-write-json/ . The dependency for this libary has already been added to the repository.

Please see the createAndPrintJSONObject() function in the Main class file. Run it (It will start the server), and look at the console output. Because I am having issues "pretty printing" the JSON object, copy and paste it into this website: https://jsonformatter.curiousconcept.com , you will see that it is the same as the example object.

If you have any questions please do not suffer in silence, we are here to help one another.

Thank you!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages