A simple implementation of the rsa algorithm

Assignment Help Computer Networking
Reference no: EM13342037

Encryption – a simple implementation of the RSA algorithm 


In this assignment, your task is to implement RSA in a simple client/server application using sockets. The client program encrypts all messages sent to the server. Once a connection is established, the server has to send its public key for the session to the client. The client will then use the public key to encrypt messages sent to the server. The server uses its private key to decrypt the messages and print out the decrypted messages received. 

For subsequent new connections (new sessions) the server's public and private keys should be different. For this assignment you should use TCP, and you do not have to implement non-blocking communications. 

When running the client and server, if the user types into the client “hello”, the server would receive the message, decrypt it and print something like the following: 

The server received the message “A85CE8DC452CAE51” 

And after decrypting the message received is “hello” 

When printing the message received, you should print it in hexademical as above. Be very careful with newline characters because these can throw off the encrypted ciphertext completely, and decrypting would give the wrong answer. You should remove any newline characters before encrypting and before decrypting. 


Implementation Details 

There are unfortunately a lot of details in a real implementation of RSA that might have to be left out in order to keep this task in the scope of an assignment. You have to ask the following questions regarding some decisions about your implementation of a simple RSA algorithm: 

1. What will the sizes of the keys be? 

2. Should encryption be done character by character or computed over a set of characters (block-wise)? 

3. Should messages be padded? 

4. Do you need an arbitrary precision library or will you use keys small enough to use simple exponential code? (Note: you will not be penalised for using small keys). 

5. How will the public key be sent from the server to the client? In hexadecimal? What will the packet format look like? 

6. Where do the public and private key pairs come from? 

The answers to these questions will determine how your encryption protocol works. 


1. You are allowed to use relatively small prime number pairs, but do not use pairs that will make the same keys for encryption and decryption. So avoid the pair p=5 and q=7, for example. 

2. The keys should be different for each subsequent connection (ie. every time a client connects to a running server). You can use a limited set of keys defined statically in your program, or compute a new private/public key pair when the client asks for the establishment of a connection. You can repeat the keys you use every 3 or more connections. 

3. You can use the client and server starter programs on Stream, and feel free to change them as you see fit. 


1. Submit your client.c and server.c code electronically via Stream. 

2. This assignment is worth 15 marks. 

3. Marks will be subtracted for obvious copying and/or for delays without justification.

Reference no: EM13342037

Diagram of simplest connection between two computers

Using Ethernet Network Interface Cards or NICs, diagram simplest connection between two computers which will allow for communications and resource sharing.

Company in manhattan still keeps to the traditional mailing

A company in Manhattan still keeps to the traditional mailing approaches even though the nature of their business strictly involves confidential documents that need to be sent

Explaining ethical or unethical actions

Should Iris have placed CD back at coffee station and forgotten entire thing? Describe why that action would have been ethical or unethical.

Implementing ospf over a multipoint frame

Implementing OSPF over a Multipoint Frame Relay needs more planning and requires specific configurations such as (1) a single subnet for every PVC or (2) a single subnet for

Implement tftp using the user datagram protocol

File system module design: This component is responsible for accessing the le systems of the sender and the receiver. The sender and the receiver have to read and write corr

What was the analytical engine

Search the Web and find the answers to the following questions. For each question, make sure you include the /urls you used to find your answers: Who is often called the "Fath

Basic requirements for data communications and networking

List some of the basic requirements for the data communications and networking required to support the business information needs? Discuss in scholarly detail. Your answer s

What other essential components does lan needs to have

A Local Area Networks connects computers together to exchange data. Apart from the computers, and other devices like printers and faxes, what other essential components does


Write a Review

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd