Symmetric Key Cryptographic Techniques getting obsolete with the increasing number of users over the Internet, public key cryptography techniques came into existence and are playing a vital role in today’s computer networks.
In Public Key Cryptography, inspite of having a shared key between sender and receiver, there are 2 keys.
Let us Suppose, James is the sender and Steve is the receiver.
Steve will have 2 keys, one is Public Key– that is available to the whole world and the second is Private
Key– that is only known to Steve.
We will use Us for the public key of Steve and Ks for the private key of Steve.
James in order to send a message to Steve securely, will 1st fetch the public key of Steve (that is known to everyone). Now James will encrypt a message, m , using an encryption algorithm and the public key of Steve. That means, James will perform, Us (m).
On receiving the encrypted message from James, Steve will use a decryption algorithm and his private key, to get the plain text. Steve will compute Ks(Us (m)). You can clearly see that, James and Steve can securely send a message to each other, without sharing or distribution of any key ( that has to be done in Symmetric Key Cryptography).
But a problem arises in such cases. As the public key of Steve is well known to everyone around the globe, thus anyone can encrypt a message using his public and send it to Steve, impersonating himself as James. In Symmetric Key cryptography, as sender and receiver share the key, they both are verified of each other identity. But this is no longer available in Public Key Cryptography, as the public key is known to everyone. Therefore, to overcome this problem of authentication, we have a phenomenon, known as Digital Signature, that I will discuss with you later.
Let us now start with some Public Key Encryption Algorithms.
RSA Encryption Algorithm
RSA was named after the scientists who developed it i.e. Ron Rivest , Adi Shamir , Leonard Adleman . Lets now see the working of RSA. But before directly coming to the implementation of RSA, let’s have a look at some mathematical calculations, as RSA makes a large use of modulo-n for computing and encrypting a data. In modulo, if you compute A modulo n, then the result will be the remainder left after dividing A by n.
For example: If you compute 24 mod 5, the result will be 4. There are various operations associated with modulo. These are as follows.
- [( (a mod n) + ( b mod n )] mod n = (a + b) mod n
- [( (a mod n) – ( b mod n )] mod n = (a – b) mod n
- [( (a mod n) * ( b mod n )] mod n = (a * b) mod n
- ( ( a mod n)^d ) mod n = ( a^d) mod n
1. Choose two large prime numbers a and b.A question arises, how large the numbers must be ? The answer is, as much the numbers are large, the more harder is to break the RSA algorithm. But also, it will takes more time to compute encryption and decryption. Thus it is recommended that you use prime numbers of the order 1024 bits.
2. Calculate n = a * b and y = ( a-1) * ( b-1 )
3. Select a number e , less than n ( e < n ) such that e and n doesn’t have any common factor other than 1.Hence m and n are said to be as relatively prime.e will be used in encrypting the message.
- 5 and 11 are relatively prime, as they have only 1 as a common factor.
4. Find a number z such that ez-1 is exactly divisible by y. We can also write it as that select z such thatez mod y =1.z will be used decrypting the message.
5. Now the public and the private key of Steve are ready. The public key , Us that will be available to the whole world is ( n, e) and his private key , Ks is ( n, z ).
Let us take an Example that will make clear , how the RSA algorithm works.
So you must have noticed that RSA is secure in the sense, there are numerous number of prime numbers there for computation. Hence it will be a very brainstorming task for an Intruder to break the code and get the plain text.
Thank You for reading the article. We hope you enjoyed it.
This is all from us on Computer Networking using Public Cryptography. You can share your insights with our readers.