Question: Overview. Write a program to implement the RSA public - key cryptosystem. The RSA ( RivestShamir - Adleman ) cryptosystem is widely used for secure
Overview. Write a program to implement the RSA publickey cryptosystem. The RSA RivestShamirAdleman cryptosystem is widely used for secure communication in browsers, bank ATM machines, credit card machines, mobile phones, smart cards, and the Windows operating system. It works by manipulating integers. To thwart eavesdroppers, the RSA cryptosystem must manipulate huge integers hundreds of digits The builtin CJava type int is only capable of dealing with or bit integers, providing little or no security. You will design, implement, and analyze an extended precision arithmetic data type that is capable of manipulating much larger integers, using BigInteger in Java or simply using Python. You will use this data type to write a client program that encrypts and decrypts messages using RSA.
Note: the training wheels are off on this assignment you're starting with a blank screen, not our code. This means that you must pay particular attention to the process of building up your program from scratch. Consider carefully how your program should be structured and how you are going to implement the various functions before plunging in Remember to thoroughly test and debug each function as you write it
The RSA cryptosystem. The RSA public key cryptosystem involves three integer parameters and that satisfy certain mathematical properties. The private key is known only by Bob, while the public key is published on the Internet. If Alice wants to send Bob a message eg her credit card number she encodes her message as an integer that is between and Then she computes:
Mmodn
and sends the integer to Bob. As an example, if then Alice computes
modmod
When Bob receives the encrypted communication he decrypts it by computing:
modn.
Continuing with the example above, Bob recovers the original message by computing:
mod
To check your arithmetic, you may use Matlab, maple.
Part extended precision arithmetic The RSA cryptosystem is easily broken if the private key or the modulus are too small eg bit integers The builtin C types int and long can typically handle only or bit integers.
Your main challenge is to design, implement, and analyze an extended precision arithmetic data type that can manipulate large nonnegative integers. To make it easier to check your work, we recommend working with integers represented using familiar decimal base notation. We note that you could achieve superior performance by using a base that is a power of eg or
Your data type will support the following operations: addition, subtraction,
Random number generation. Implement a function Math. random that takes as input an integer and returns a pseudorandom extended precision integer of at most digits by choosing each digit at random. This will be useful in debugging the subsequent code, and also in analyzing its complexity. Parity. Implement the function sodd that takes an extended precision integer as input and return if and only if it is odd. You may assume that the base is even, so that this amount to checking the parity of the least significant bit.
Comparisons. Implement the following functions: XPgreater XPess and XPeq They should take two Ndigit extended precision integers as input and return if and only if the first integer is greater than less than, equal to the second.
Subtraction. Implement the functions Xsub It should take two digit extended precision integers as input and return a third extended precision integer that is the difference of the two. You should check that the first integer is greater than or equal to the second before subtracting; otherwise output an error message.
Multiplication. Implement the function XPmu It should take two extended precision integers as input and return a third extended precision integer that is the product of the two. Observe that if a and are digit integers, the product will have at most digits.
Division. Integer division is the most complicated of the arithmetic functions. Here is one of the simplest algorithms to compu
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
