Okay.
So so far we learned how to use BGP to encrypt text and send it in a way so that the receiver is the
only person that's able to read the content of the text.
Not only that, but we also learned how to sign the message, to sign the text so that the receiver
can verify that this message was actually sent from us, from the sender.
So it's really, really good because now when a message is sent, we're sure that it can only be read
by the receiver and the receiver can be sure that it was actually sent from the sender.
And he can also verify that the message did not get modified as it was sent.
So this is really, really good.
The only problem is we can only do this for text.
So what if you wanted to send a document or an image?
Therefore, in this lecture, I'm going to show you how to encrypt, sign, verify and decrypt files.
So right here in John's computer, I have the image that we already worked on and removed its metadata
before.
If you don't remember how to do that, please go back to that lecture.
And if I double click the image right now, as you can see, the image works.
It shows us a picture of a car.
Now, let's assume we want to send this message to David and we want to send it securely so that if
anybody intercepts this message or if anybody manages to read it, they won't be able to see the content
of it.
They won't be able to see the image.
To do that, we're going to right click it and we're going to click on Encrypt.
Now you'll get a message that is very similar to what we used to get when we encrypt text.
You need to select the public keys of the people that will be able to see the contents of this file.
In my case, I'm sending this to David, so I'm going to take David from here.
And as we learned before, you can also sign the message from here and select your own private key.
And that way, when the receiver receives the image, they can verify that the message or the image
was sent from you by verifying it with your own public key.
So I'm going to click on.
Okay.
This will ask me for my passphrase, for my private key, because I selected the sign option.
If you did not select the sign option, you will not see this.
And once I put the password, as you can see, I will have a new image created.
And this image doesn't really display it doesn't really work.
So if I double click it, you actually won't see anything in here.
And the reason for that is because this image right now is encrypted and the only person that can see
it is David.
So we need David's private key in order to see the contents of this message.
Therefore, like I said, right now we're in John's computer, so even John can't see the content of
the image anymore.
And what we're going to do is we're going to go ahead and send this as an attachment in an email to
David Smith at the blue dot in.
I'm going to scroll down.
I'm going to select the image.
And keep in mind you want to make sure you select the encrypted image, not the normal image.
So right here we have the normal decrypted image, as you can see.
We can see it in here and the preview and right here we have the encrypted version of it that will not
work unless we have the private key of David.
So I'm going to click on Open and just say Test in here and the content and click on Send.
Perfect.
Now the message should be sent.
So let's go to David's computer.
We'll refresh the inbox.
We have a new message.
Perfect.
Let's go ahead and open it.
And we're going to download the attachment.
Save it.
It's going to go in my browser directory.
That's fine.
Click on Save and let's go ahead and open the containing folder.
And as you can see, we can't really see the contents of the image.
Now this is the same whether this was a PDF or a word document or any file.
Really, I'm just using the image as an example now in order to decrypt this message, because this
is David's computer and because this message was specifically encrypted for David using David's public
key, we can actually decrypt it right here because we have David's private key and we'll be able to
see the contents of it.
To do that, we're going to right click the image.
We're going to click on Open with Decrypt File.
This will ask you for the passphrase for David's private key.
I'm going to input it.
I'm perfect.
As you can see, this will create a new file.
This is the image after decryption.
And as you can see in the middle, it said that the signature has been verified.
So we're sure that this image was actually sent from John.
Now I can double click the image to see its content and as you can see, I'm able to see the contents
of the message.
So the idea behind this is very similar to the idea of sending text.
We encrypt the message with the receiver's public key.
If anybody manages to get their hands on this file, whether it's an image, a PDF, a document doesn't
really matter.
They won't be able to read the content of the file unless they have the private key.
Now, there is also one more feature that I want to cover in this lecture, which we can use to sign
the file without encrypting it.
So if you remember when we downloaded the Tor browser, we also downloaded a signature and we use that
signature to verify that the Tor browser did not get modified as we downloaded it.
So you can also do this to any file you send by generating a separate signature.
So again, you can do this to any file you want, whether it's software, whether it's an image, a
PDF, a microsoft document.
It really doesn't matter.
I'm using the image here as an example at John Wick's computer right now, and all you have to do is
click the file that you want to sign, click on sign.
It will ask you which private key you want to use to sign this file.
Like I said, I'm in John Wick's computer.
The only private key that I have right now on this computer is John Wick.
So the only entry I have in here is John Wick.
So I'm going to click on.
Okay.
And as you can see, this will generate a new file with a dot sig extension.
This is a signature that corresponds to this file that has been generated using John Wick's private
key.
So people can use this file to make sure that the image did not get modified since this signature file
was created by John Wick.
And to do this verification, they'll use John Wick's public key.
So the private key is used to generate the signature.
The public key gets used to verify that the signature did not get modified.
Now, if you are doing this, you will obviously have to send the signature file with the image file
to the receiver.
So let me do this really quick here.
Again, we're sending this to David Smith.
And like I said, you want to make sure you first select the file that you want to send, which in my
case is the image.
And you also need to select the signature.
So I'm going to select the image first and then click on attach and then I'm going to select the signature
file as well, like I said.
And we're going to open and click on Attach again.
And right now we have the two files added to the message.
I'm going to click on Send to send the message.
Now, keep in mind right now, we did not encrypt the image.
If someone manages to intercept this file, they'll be able to see the contents of the image.
We only sign the image with a separate signature so the receiver can verify that the image did not get
modified as we sent it.
So go into the receiver's computer.
Let's go refresh the inbox and we'll go open it.
Open the new message.
And let me actually delete what I have in here for now.
And we're going to download the image.
And then we'll download the signature.
And go into the downloads directory.
As you can see straight away, we're able to see the contents of the image.
So the image was not encrypted because all we did is we generated a signature for the image.
So the whole purpose of this is to allow the receiver to verify that this message was sent by John and
that the message did not get modified.
Since John created the signature to do this, you right click the signature and we're going to click
on Open with Verify Signature.
And as you can see, it's telling us that this is a valid signature.
And like I said, the untrusted warning can be ignored.
It literally just means that the key has not been set to trust it.
But the fact that it is saying a valid signature means that this image did not get modified since John
created this signature right here using his own private key.
So that's it for this lecture.
I just wanted to show you how we can use BGP to encrypt files, sign them so that they can then be verified
and decrypted at the destination.
And this way we're able to send files securely, because even if they get intercepted while they're
being transmitted, whoever intercepts them, they won't be able to read their content.
Not only that, the receiver will also be able to verify that the file did not get modified as it was
sent, and verify that it was sent from the right person, not from a third party.