Anda di halaman 1dari 7

Introduction to Public Key Encryption

Lets consider a situation, in which a person wants to communicate with another person, and the only
way he can do is by shouting the message out openly, such that the other person hears it. Well, if it
were a confidential message, doing this wouldnt be the best possible option
You could look towards other means of communicating, but if you are forced to communicate in this
way only, you surely would be trying to find another way of keeping your message a secret.
One possible way to do this is that you both can sit and learn a new foreign language, which hopefully
nobody understands, and the shout publicly your message in the new language.
Encryption is just that
You give the computer a message, the message is translated by the computer in a new foreign
language of numbers which is then used accordingly.
Public Key Encryption is a modern way of cryptography which involves the use of two passwords. You
give the message to the computer and a key as well. This key( Public Key) , taking an analogy of the
world above, tells the computer the language in which it has to translate the message. This key is only
capable of giving the computer the way to translate the message into the language X. It doesnt give
the capability of translating it back to the original language.
There is another key( Secret Key ) which is used for doing the reverse. It has only the capability to
convert the language X to the original. It cant do the other way round.
The public key is shouted openly by the person who wants to receive the message. The person who has
the message encrypts it into language X by the means of that key. and he shouts the message in
language X. The recipient on receiving the message can convert back the message as he has the secret
key which can do the reverse.
As the public(the intruders) only has one key, namely the public key, it only encrypt but not decrypt.
This is the basic principle of public key encryption.

Synopsis

This project has 3 programs which are independent of one another, namely,
KEYGEN.CPP
BROWSER.CPP
SERVER.CPP
There are also 5 Text files which play an important role in coordinating the above 3 programs.
PTEXT
KEYS
SECRET
CIPHER
DECPT
The KEYGEN program generates two prime numbers and accordingly generates the two keys
required for public key encryption.
The public key is stored in KEYS.
The secret key is stored in SECRET.
The BROWSER program takes the message from PTEXT and converts the message into a cryptic
language which is stored in CIPHER, using the public key taken from KEYS.
The SERVER program takes the encrypted message and using the secret key from SECRET, it
converts the cipher into understandable language which is stored in DECPT.
We always get the output of DECPT the same as which we have entered in PTEXT.
All the three programs are totally independent of each other and they only depend on the text
files with which they interact.
All the three programs works according to an algorithm called the RSA algorithm. This algorithm
is the most widely used and trusted algorithms of all time. Notably, it is the algorithm which
Google uses to secure its servers. It is through this algorithm that our internet browsers are able
to communicate with the servers across the globe.
A detailed analysis of the RSA algorithm is given in the appendix section of this project.

Appendix
RSA Algorithm:
The RSA algorithm is based on the fact that multiplying two numbers in quite easy but factoring a
number into its constituent prime numbers is a very difficult task.

KEY GENERATION
It takes two primes , Let's say p and q .
]

[ The game here is all about these two prime numbers

We take another number n, such that n =( p * q )


we also have another number called totient = (p-1) * (q-1)
Now we choose a number e such that it satisfies the following conditions
1 < e < totient
e and n are relatively prime.
There exists another number d such that e*d= 1 (mod n) = 1 , i.e. (e*d)/ n should give a remainder as 1.
The key pair (n,e) becomes the public key,
The key pair (n,d) becomes the secret key.

ENCRYPTION:
Let the message be m.
We get the corresponding ciphertext c as , c= m^e (mod n)
This c becomes the encryption for the message m.

DECRYPTION:
Let the ciphertext c be the input which is encrypted.
We get the message z back by z= c^d (mod n), where d is the secret key.
It can be mathematically proven that z is numerically equal to m and hence we get our message back
from the ciphertext.

The security of this algorithm arises from the fact that n cannot be factored easily into p and q and
hence one cannot find the other key if he has one of the key.

Anda mungkin juga menyukai