I have a new project (project 2) to do which is on top of a previous one that I did before (project 1) in java. My code is running well but it has a mistake when encrypting (on Client side) and decryption (on Server side). I have tried to use ASCII function to that, but you may need map each letter to its number to make it work. (if else … to all letters 52).My Requirements:1) Fix my code in HW project 1.2) Implement DES without using any import library made special for DES.You have to do it as it says in the attachment exactly. If you have any question, you may ask. The deadline for this HW is Wednesday mid-night.
Unformatted Attachment Preview
Programming Project 1
In this project, you will write a program (server-client model) using sockets for communication;
for more information about socket programming, please refer to the tutorial links posted in the
Canvas under the Supplements menu link. The program simulates the communication between
Client and Server using shift cipher and works as follows:
1) Client connects to the Server using socket; Server takes only one Client.
2) Upon a successful connection, client generates a random number k where 1 <= k <=1,000,000. 3) After generating the random number, Client calculates a secret key k as k = (a · k + b) mod 52 where a = 250 and b = 479. (a and b are explained in step 6) 4) Client repeats steps 2) and 3) until k becomes non-zero number. 5) Once Client obtains non-zero k, it sends k to the Server as a plaintext without encryption (and as a result they have the same k); we assume that there is no attacker who modifies k value. 6) Server transforms k to k using the same equation that the Client used; k = (a · k + b) mod 52, where a = 250 and b = 479. We assume that a and b are shared between Client and Server even before the connection is established. Of course a and b can be any number. However, to make the program testing easy, we fix their values for this project. 7) Now, Client and Server have the same secret key k. 8) To use Shift Cipher, we are numbering each letter as follows (total of 52 letters including upper and lower cases): A B C D E F G H I J K L M 0 1 2 3 4 5 6 7 8 9 10 11 12 N O P Q R S T U V W X Y Z 13 14 15 16 17 18 19 20 21 22 23 24 25 A B C D E F G H I J K L M 26 27 28 29 30 31 32 33 34 35 36 37 38 n o p q r s t u v w x y z 39 40 41 42 43 44 45 46 47 48 49 50 51 9) When Client sends data to Server, each letter in the plaintext is encrypted as follows: a. y = ek(x) = (x + k) mod 52 (where x is a letter in the plaintext and y is a letter in ciphertext transmitted to the Server) b. After encrypting the plaintext, the Client must display (plaintext, ciphertext) pair on the screen. 10) When Sever receives ciphertext, each letter in the ciphertext is decrypted as follows: a. x = dk(y) = (y - k) mod 52. b. After decrypting the ciphertext, the Server must display (ciphertext, plaintext) pair on the screen. c. For each message, server also sends acknowledgement message to client. Programming Project 2 1. Description In this project, you will add one more cryptographic algorithm, DES, in the program implemented for Project 1. The program simulates the communication between Client and Server using shift cipher and DES, and works as follows: 1) Client connects to the Server using a socket. 2) Upon a successful connection, Server sends two options (1. Shift cipher and 2. DES) to Client so that the client can choose one of them for future communication. 3) If Client chooses Shift cipher, then the programs works in the same way as project 1. In this case, the program takes a set of letters as a string transmitted to the Server. 4) If Client chooses DES, it must follow the steps below. 5) Client program reads a file (in plain text format; .txt) consisting of several lines of hexadecimal numbers. The length of each line will be a multiple of 64 in binary, such as 64, 128, 192, ) 0000000000000000 211ACB937827FC63 783920AB3DE82938 9283028BC233A3CC 2938A783CAD3EF29 BCDF2039482029A3 32918ACDEC9C37AD 1129283113131239 6) After reading each line from the file, the Client encrypts each block of 64 bits by using DES; please refer to https://en.wikipedia.org/wiki/DES_supplementary_material for IP, IP-1, E, P, PC-1, PC-2 and S-boxes. You can simply hard-code these in your program. 7) After encrypting the plaintext (lines from the file), the Client transmits the data out to the Server through socket. 8) For encryption and decryption, we assume that C30950FA36CF58CF(16) in hexadecimal number is used as a shared key. 9) When Sever receives ciphertext, each block of 64 bits in the ciphertext is decrypted by using DES. 10) For each message, server also sends acknowledgement message to the Client. 11) Client and Server display plaintext and ciphertext before it transmits ciphertext out through the socket. 12) Client and Server display ciphertext and plaintext after it receives ciphertext through the socket and decrypts it. 2. Note The program is an extension of the program 1. 3. Submission Guidelines a. Only submit source code files. (NO object or project files) b. Along with the source code files, please submit input files used to test your program. c. Please compress all your files to .zip format. d. You must submit the zip file through your Blackboard account. ... Purchase answer to see full attachment
Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.
You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.Read more
Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.Read more
Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.Read more
Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.Read more
By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.Read more