CS 342 - 11/16/17 Exam 1 Results Count 153 Max 98 Min 16 Ave 69.43 Median 70 St.Dev. 14.24 90's 4 80's 32 70's 41 60's 43 50's 16 40's 12 30's 3 20's 1 10's 1 Protocol for Echo Client Client Server ------- ------- Get message Send to Server ---> Receive Message Display Message Receive Message <--- Send Message Display message Repeat Repeat Possible Protocol for Battleship Player 1 Player 2 -------- -------- Determine location Send ---> Receive Determine Hit/Miss & UPdate GUI Recieve <--- Send Update GUI End Turn ---> Determine location Receive <--- Send Determine Hit/Miss & UPdate GUI Send ---> Receive Update GUI <--- End Turn Repeat Repeat For Project 5 and Supporting Document 4 Create a Networked Chat with Encryption Design Document (Suporting Document 4) Due in first half of 14th week Programs Due in second half of 15th week Network Chat would use a central server that all clients connect to. A message from Client X to Client Y would pass first from Client X to the server, then from the server to Client Y Tasks associated with the Server: 1. Allow new clients to connect - Server must notify all the other clients of the new Clients - As Clients disconnect, the server must notify all other Clients of the disconnection. 2. Acts as the mediator of the message sending Monitoring each socket for message input ane then forwarding the message along to the proper client. 3. Public Key distribution would be sent to all other Clients (Perhaps this is really Tasks 1b.) Tasks Associated with the Client 1. Create the Public/private key pairs 2. Connect to the server. 3. Monitor the server for incoming messages. - Info about new Clients or removal of existing Clients - Messages send to this Client 4. Send a message to the server for Client Y 5. Encrypt messages being sent 6. Decrypt messages received RSA Encryption/Decryption Most of the following is from: http://www.geeksforgeeks.org/rsa-algorithm-cryptography/ Public Key consists of two values: n, e Private Key consists of two values: n, d Encrypt Message M : M^e % n ===> M' Decrypt M' : M'^d % n ===> M Start with 2 prime: p, q Calculate n: p * q Calculate phi: (p-1)*(q-1) Calculate/Select e must be an integer must be "relatively-prime" with phi must be in range 1 < e < phi Determine/Select d d = (k*phi + 1) / e for some integer k where e must divide (k*phi + 1) evenly ((k*phi + 1) must be a multiple of e) Mutliple values could be used for e or d, sometimes the Xth smallest value is used to add extra security/randomness Assume the message is: Meet me at the CS Lounge at noon. Blocking Size ==> Characters per message Messages to encrypt are as follows if blocking size is 2: Me => Numeric value ==> et m e .... There would be 17 different Encrypted values to be sent. How to we send these values from client X to Client Y? We will send an object that has a integer vector? Messages will be sent as Character Strings 1. First character indicate the "message type" Message Type one: New Client Char 1: a Next: Client Id (must be unique) Next: e value for client as a ASCII decimal value Next: space Next: n value for the client as a ASCII decimal value Message Type two: Remove Client Char 1: b Next: Client Id (same from Message Type 1) Message Type three: Send Message Char 1: c Next: To Client Id (same from Message Type 1) Next: From Client Id (same from Message Type 1) Next: encrypted value as a ASCII decimal value Next: Space Repeat last 2 for as amany as needed