- The words encryption and decryption
are quite familiar to us.
You might have already come across these technical words
in this video series, as well as in your daily life.
What is encryption and why is it needed?
At the end of this video,
you will also understand the magic that prime numbers play
in encryption and decryption technology.
How do our messages travel through the internet?
There is a local internet service provider
communicating with a regional service provider,
followed by a network service provider
and then the final destination.
We know that data travels in packets
and could take any path through the different routers
to reach the destination.
And in general, we assume that IPSs or NSPs
don't eavesdrop on our communications.
When we are connecting to a public Wi-Fi hotspot
in a restaurant or a shopping mall,
we have to be cautious
that whoever installed the Wi-Fi hotspot
is unable to see what we are browsing.
Many of you will have noticed the prefix is HTTPS and HTTP
being shown on URL addresses.
These are internet protocols for communication.
And S represents that the communication is secure.
For a secure communication,
the access point provider won't be able to know anything
other than that we have accessed this site.
They cannot see our logins, which page we are looking at,
or anything else.
All of these are encrypted.
In a cellular communication,
the data to your cell tower is usually encrypted.
Let's look in detail
at how this important encryption operation is done.
Encryption is the process of transforming plain text
to cipher text.
In this example, the text message is encrypted
by adding one digit.
This is the encryption key.
Only the receiver who knows the key can decrypt the message
and an intruder cannot.
You can consider this case as similar
to a confidential document being locked in a briefcase
before sending it to its destination.
A thief or the transporter
will not be able to access the document.
Only the receiver with the key to the briefcase
will be able to open it.
A very responsible key distribution center
takes the responsibility
of transferring the key from the sender to the receiver.
If the receiver uses the same key to open the suitcase,
it is called symmetrical encryption.
If the opening key is different to the locking key,
the encryption method is called asymmetrical.
However, what if the key itself is stolen?
To overcome this issue,
let's design an intelligent locking system.
In this system, each user has two keys.
The user submits one of his keys
to the key distribution center.
It means this key is publicly available.
Let's call this a public key.
However, nobody shares the other key.
This is private to each of the users.
The most interesting part of this new system is the lock.
The lock can be closed with any public key.
But the same key cannot open the lock.
To open it, you have to use the corresponding private key.
No other user's private key or public key
will be able to open this lock.
With this system, the data transfer is highly secure.
Let's see how.
If Nina wants to send the box to Alex
Nina requests the public key of Alex from the KDC.
The KDC shares the public key with Nina
and she locks the box.
After transportation,
only Alex will be able to open the lock
because only he has the private key.
This system is highly secure
because Alex hasn't shared his private key with anyone.
In the digital world, we can build the same system.
Here this HELLO message
is encrypted with Alex's public key and sent.
Only Alex's private key will be able to decrypted back
and only Alex will be able to do that.
Now let's examine one peculiar property of the new lock.
We have already seen that a lock closed with a public key
can be opened only with the corresponding private key.
Can these two keys have a random shape?
Even if such a lock exists, it cannot have a random shape.
The shapes of the keys have to be connected in some way.
One example of such a connection is shown here.
Similarity in the digital world,
the keys we saw earlier should be connected
otherwise the algorithm will not work.
An efficient connection between these keys
is that they are derived
from the product of two prime numbers.
In the previous example,
we saw that the public key of Alex was in fact,
the multiplication of two prime numbers.
The private key of Alex
was one of the factors of this public key.
The algorithm we have seen is just a representative one.
In actual algorithms prime numbers are not directly used
to produce public and private keys.
A popular algorithm used in the private public method
is called RSA.
Let's see how RSA uses two prime numbers
to generate private and public keys by using an animation.
The encryption and decryption of the letter H
using these keys is also animated here.
Please note that a detailed explanation of this algorithm
is beyond the scope of this video.
Now, you might have a question in your mind.
Why are we using only prime numbers
and not any other numbers?
The process of finding out the factors of a number
is known as factorization.
A hacker always uses some brute force method
to factorize the numbers involved.
Thus, he can find out the private key.
The factorization algorithm works quite fast
when the factors are not prime numbers.
However, if the factors are prime numbers,
the algorithm is quite slow,
especially when the prime numbers are big.
This way the hacker will struggle to get your private key
from the RSA algorithm using brute force.
You must not get the impression
that the asymmetric encryption method,
such as public private key cryptography
has superseded symmetric encryption methods.
One major issue with the asymmetric encryption method
is that it is very computationally intensive.
We have already seen in RSA
that the algorithm will prevent a brute force attack
only if the prime numbers are huge.
This means if we use RSA directly,
it will cause a significant time delay in exchanging data.
One clever remedy for this problem
is the symmetric encryption systems
like Advanced Encryption Standard AES,
which are widely used today.
In such systems using public private key cryptography,
a key is exchanged as the very first message.
This key is known as a session key,
and it is a symmetric key.
Using this symmetric key,
the two parties can continue their remaining data exchange
without further key transfers.
(upbeat music)
The session key is frequently updated
depending on the communication protocol used.
For example, in WhatsApp
for every message there is a new session key.
In HTTPS, it may be for a certain period
or until the session ends.
The key size for a public private key is around 2048 bits
and the encryption and decryption takes more time
when compared to symmetric systems
which employ key sizes of around 256 bits.
The message is encrypted by the 256 bit symmetric key
are no less secure than the 2048 bit asymmetric key system
and are less computationally intensive.
The public private key approach
also creates a way to authenticate a message.
Authentication means that Alex has to make sure
that this message is from Nina.
For this, Nina encrypts the message
with her own private key.
Now Alex can decrypt this message with Nina's public key,
and can make sure that the message is from her
because only Nina has her private key.
Here Nina is said to have signed that message
and not encrypted it
because anybody can decrypt the message.
We hope this video has given you some great insights
into encryption and decryption.
Please support our educational services
by clicking the Help button.
Thank you