RSA Algorithm CS13
RSA Algorithm CS13
RSA Algorithm CS13
MCA – I I I Semister
CS-13
RSA Algorithm
MCA(6)
By Kartik Shah
1
LAY NETWORKS
In a classic cryptosystem in order to make sure that nobody, except the intended
recipient, deciphers the message, the people involved had to strive to keep the
key secret. In a public-key cryptosystem. The public key cryptography solves one
of the most vexing problems of all prior cryptography: the necessity of
establishing a secure channel for the exchange of the key.
The RSA algorithm, named for its creators Ron Rivest, Adi Shamir, and Leonard
Adleman, is currently one of the favorite public key encryption methods. Here is
the algorithm:
1. Choose two (in practice, large 100 digit) prime numbers p and q and let n
= pq.
2. Let Pi be the block of (plain) text to be encrypted. Actually Pi is the
numerical equivalent of the text which may either be single letters or
blocks of letters, just as long as .
3. Choose a random value E (usually small) such that E is relatively prime to
. Then the encrypted text is calculated from
2
LAY NETWORKS
By Euler's theorem
Therefore, we have an equation that can be used to find the "key" exponent D.
The central result of the RSA algorithm is that this equation is computationally
solvable in polynomial time (actually using the Euclidean Algorithm) whereas
solving by factoring n requires exponential computational time. [Note however
that this last statement has never actually been proven but only demonstrated
given today's algorithms. Should someone discover an algorithm that factors
integers in polynomial time, the RSA and similar algorithms could be rendered
useless for secure communications.] Central to these calculations is knowing the
factorization of n, since we will need to calculate both and .
Example
Suppose we wish to encode the plaintext message Pi = 3 (that is, under our
encoding some letter has been assigned the numerical value 3) subject to our
3
LAY NETWORKS
choices of p=11, q=17 (thus, n=187) and E=7 (note that 7 is relatively prime to
187.) Then the ciphertext Ci is given by
Why was there a warning in the previous example? If you have been closely
examining what has taken place in the RSA algorithm you may have noticed that
although we know the factorization of n (since we choose the prime factors p and
q) and hence , we may not have an easy time determing
, which requires us to know all the factors of what
could be a very large number. This seems to contradict the polynomial time
needed to solve for the key. The solution is (and is a key -- unintentional pun --
element of the RSA algorithm) that the formula for D, although concise, is not
the way the solution is found in practice. The actual method of solution (which
does require polynomial time computation) is based on the Euclidean algorithm.
4
LAY NETWORKS
Hence D=23! Thus the real key to the solution of D is knowing which
requires the knowledge of the factorization of n since .
d * e 1 (mod ø(n))
where ø(n) is the number of positive integers smaller than n that have no factor
except 1 in common with n
The integers n and e are made public, while p, q, and d are kept secret.
Let m be the message to be sent, where m is a positive integer less than and
relativley prime to n. A plaintext message is easily converted to a number by
using either the alphabet position of each letter (a=01, b=02, ..., z=26) or using
the standard ASCII table. If necessary (so that m<n), the message can be broken
into several blocks.
The encoder computes and sends the number
e^d mod n
Now, since both n and e are public, the question arises: can we
compute from them d? The answer: it is possible, if n is factored into
5
LAY NETWORKS
prime numbers.