Now, so far we have David, who wants to send a secret message to John.
To do this, John generated a key pair.
John also sent the public key to David.
David has downloaded the public key and imported it into his key ring.
So if we go to David's computer right here, we can see he has John's public key.
So right now, David can encrypt data with John's public key.
Send it to John.
And that way John will be the only person who can decrypt this data because he is the only person that
has his own private key.
Now, you'll also notice an extra entry in here.
I've actually created a key pair for David in this section right here, for the sake of completion.
You don't have to do this because, like I said, all we need is John's public key to send data to John.
And according to the example we're doing, David will be sending data to John.
So all we need is John's public key.
I just created a key pair here for David, just for the sake of completion so that you can see how this
will work in a real life scenario.
So we actually don't need to use this anymore because David already has the public key of John.
So all you have to do is literally start typing the message that you want to send to do this.
I'm just going to open a text editor and I'm just going to start composing the message.
So for this, we're just going to say hello.
This is a secret message sent from David to John.
Now to encrypt this message, we're going to click on the recipients in here to set the person that
we want to encrypt the message to.
So first of all, as you can see, to prove our authority or to sign the message, we're going to be
signing it as David, because we have David's private key and this is David's computer, and then we're
going to encrypt it for myself so that I can actually read the message.
And we're also going to tick this box to encrypt it for others.
And here we're going to put the names or the public keys of the people that we want to share this with.
So we want to send this to John.
And therefore, I'm going to type John.
And as you can see, I'll get his key entry suggested to me in here.
So all I have to do is click this and that's it.
The message is going to be encrypted for him using his public key and for myself using my public key
so I can read it.
And also it's going to be signed using my private key so that John can validate the integrity of the
message and make sure that it is actually written or composed by David.
Now that we're happy with the options, we're simply going to click on sign Encrypt.
And as you can see, it's telling us that the signing and the encryption is successful.
So all we have to do is go back to the notepad in here and we have the encrypted message in here.
So right now you can just copy all of this and send it to John using any method of communication so
you can send it as an instant message.
You can send it in a chat room, you can send it as an email, you can even put it in a pastebin publicly
where anybody can see your secret message.
This is the beauty of PGP.
You can put this anywhere and nobody will be able to see or read the content of this unless they have
the private key of John.
And like I said, if John is using PGP properly and he knows what he's doing, he should never share
his private key.
Therefore, he will be the only person in the world that is able to read the content of this message.
Now, for this example, to make things easy, I'm going to go back to my email client and I'm just
going to reply to this email.
And we'll put our encrypted message in here.
Keep in mind, I'm copying it from the start to the end.
I'm going to click on Send and that's it.
Send to John.
So let's go to John's computer.
We're going to go to his email account.
We're going to refresh the inbox and we're going to click on the message that we just got.
And as you can see, this message is encrypted.
It's gibberish.
We can't really see what David is trying to tell us.
So we're going to right click and copy this message.
We're going to go to Cleopatra.
As you can see right now, we're in John's computer.
John is in bold.
So that means we have the private key for John and therefore, we should be able to decrypt this message.
So we're going to click on the notepad again.
We're going to paste the message.
It's already in our clipboard.
And instead of clicking on Encrypt this time we're going to say Decrypt and verify.
It's going to ask me for the passphrase for John Wick because like I said, this is going to need to
use the private key of John Wick to decrypt the message.
Remember, we had to set a passphrase when we created this key pair, so I'm going to input it.
And perfect.
As you can see, we have the decrypted message right here.
So now in this example, John created the key pair.
He shared his public key with David, and David was the one encrypting the message and sending it back
to John.
Now, if John wants to send something back to David, we just have to do the reverse of the process.
So David will just have to create his own key pair, share the public key with John and then John will
be able to encrypt messages and share them with David and know that David would be the only one able
to read the contents of the messages sent to him.