In this section and in the next lectures I'm going to show you how to use PDP to encrypt and decrypt
text files emails and we're also going to use it to sign and verify the integrity of files emails and
so on.
This way we'll be able to communicate safely because everything will send and receive will be encrypted
and we'll be able to verify the integrity of the data being sent.
So we'll be able to sign whatever we send and the receiver will be able to verify that this data has
actually been sent from us and has not been tampered with.
Now the reason why we're going to use BGP for encryption and to verify integrity because this is a very
strong encryption that stood the test of time and has not been broken yet even based on leaked reports
it seems like even government agencies are not able to break it yet.
So it's a very very strong encryption.
Even though PDP stands for pretty good encryption.
This statement is actually sarcastic because this is a very strong and powerful encryption.
Now in this lecture I want to explain to you how PDP works in general and then in the next lectures
we'll see how we can use it to encrypt all sorts of data and how to use it to sign and verify integrity.
Now PDP is a public key or an asymmetric encryption.
And to understand how that works let's first have a look on the other traditional type of encryption
symmetric encryption.
So let's have an example where we have two people David and John were going to forget about how they're
going to communicate.
We're just going to assume that David wants to send a message to John.
And the content of this message is secret message.
Now if David wants to protect his message from anyone who might intercept this message or read it he
can use an encryption key in order to encrypt this message and this will transform the message into
gibberish then he can go ahead and send this message to John using any method by sending it as an email
or by post or as a text message.
It doesn't really matter.
And if this message gets intercepted the contents of the message is going to be gibberish.
So we want to be useful to the person intercepting this.
John will receive the message.
He will open the message.
The message will still be gibberish.
And then John is going to use the same encryption key to decrypt this message and reveal its content
which was secret message.
So very very simple.
Basically David uses a key to encrypt the message.
John uses the same key to decrypt it.
And this way they're both able to read the message.
But anybody who does not have the key will not be able to read the message.
So the same key is used by David and by John.
Therefore this is known as symmetric encryption.
Now you probably guessed it by now.
This key needs to be private.
That's why it's known as a secret key because anybody who manages to get his hands on this key they
will be able to decrypt any message that David sends to John and vice versa.
So based on everything that we said so far we can see that the secret key can be used to decrypt the
messages.
Because of that it should be kept secret.
But David somehow has to share it with John and anyone else.
David wants to communicate with.
Therefore this is a major flaw with symmetric encryption because the key has to be secret.
But at the same time has to be shared.
And sharing it with more people increases the attack surface.
Not to mention the problem of sharing the actual key.
How are we going to share it.
Are we going to send it in a separate message.
What if that message gets intercepted.
What if we're sending stuff over the Internet and we know how many hubs our data could pass by.
This could be intercepted read.
And then the rest of our communication will be decrypted.
This was the main incentive to come up with a more secure encryption.
And this is where asymmetric or public key encryption comes.
So let's go back to David wanting to send a message to John.
And the content of the message is secret message and asymmetric encryption one key is used to encrypt
the message.
The message is sent in the air and then another key is used to decrypt the message.
So as you can see in this encryption two different keys are used and hence the name asymmetric encryption.
Now these two keys are referred to as a key pair.
They are mathematically related.
One is used for encrypting the message and the other is used for decryption.
Therefore the decryption key is never shared.
And that's why it's more secure.
Now you're thinking if the decryption key is never shared how is this going to work.
Well let's go back and have a closer look on how this is going to work.
So again David wants to send a message to John the content of the message a secret message but before
sending this message and before encrypting it John is going to create a key keeper a public key and
a private key.
Like I said These keys are mathematically length.
And John is going to send the public key to David to the person that will send the message.
So the public key can be shared with anybody.
You can actually make it public on the Internet on key directories.
It doesn't really matter because it cannot be used to determine the private key.
Therefore it's completely safe to share the public key.
So David received the public key.
He uses the public key to encrypt the message.
The message is sent using any method doesn't really matter.
And even if it's intercepted It's going to be gibberish.
John will receive the message.
He will open the message the message will still be gibberish but he will use the private key to decrypt
this message this way he will get the content of the secret message.
And as you can see the private key was never shared.
John created the private key.
And John kept the private key.
The only thing that is shared is the public key which cannot be used to determine the private key and
cannot be used to decrypt the message.
It can only be used to encrypt the message.
So by the end of the communication David is going to have John's public key.
And John is going to keep their private key.
Therefore now David can always send messages to John and John will always be able to decrypt them using
his own private key.
Not only that but when David encrypt something with John's public key he can be rest assured that nobody
can decrypt this message except for John.
Because John is the only one that has the private key and his private key should never be shared.
If John knows what he is doing because there is no point of sharing it even if he wants 100 people to
send him messages all he has to do is share his public key and not his private key.
Now if John want to send something to David the same can be done in an opposite direction.
So David would create a keeper.
He would send John his public key and then John would use David's public key to encrypt messages.
When David receives them he will use his own private key to decrypt them.
So the idea is very very simple.
You share your public key has the name public.
That is completely safe because it can't be used to determine the private key.
And it can't be used to decrypt the messages.
So you share the public key.
And anyone who wants to send you a message they will encrypt that message with your own public key.
And this way you will be the only one that can decrypt this message.
Same goes when you want to send another message.
For example if you wanted to send a message to me all you have to do is encrypt that message with my
public key and this way because I don't share my private key with anyone.
I will be the only one that can read the message.
So you can put this message anywhere you can share it publicly and it will still be safe because no
one will be able to read that message.
But me.