Previously, we learned how to securely and privately send messages over the Internet.
And we did this by encrypting and signing the message before sending it.
This ensures that nobody can read the message except the sender that we encrypt the message for.
And it also allows the sender to first of all, verify the integrity of the message, make sure that
we are the senders and also using the signature, they can ensure that the message was not modified
as it was transmitted.
So all of that was great for text, but we still don't know how to do it for files and that's what I
want to cover in this lecture.
So in this lecture I'm going to show you how to sign, encrypt and decrypt files so that we can securely
and privately send them over the Internet and make sure that they can only be seen by the person that
we're sending this file to and also allow that person to verify the integrity of the message and verify
the sender.
Now, doing this is very easy.
Right here I am in David's computer.
This is the file, the image that I want to send.
And I have Cleopatra running in here.
As you can see, I have David's private and public key because, like I said, this is David's computer
and I only have John's public key because John is the person that I'm going to be sending this message
to.
So he's the receiver.
Now, the file right here, as you can see, it's visible.
It works.
It's a picture of me and my cat.
And what we want to do is we want to encrypt this so that the content of this image is invisible to
anybody that does not have the private key of John, because I'm going to be sending this to John.
Now, doing this is very easy.
We're simply going to go back to Cleopatra and we're going to click on Sign Encrypt.
It's going to ask me to select the file that I want to sign or encrypt.
So we're going to go to Amnesia pictures.
That's what I have the picture.
And this is the picture right here.
22 dot JPG.
You should also remove all metadata from this picture and I cover that earlier in the course.
So right now this picture is ready to be encrypted.
So I'm going to click on Open and we're going to have a dialog similar to what we had when we were encrypting
text.
So first of all, it's asking us who do we want to sign this picture as?
So we're going to be using our private key to sign it.
This allows John to verify the sender of the message.
We're also going to be encrypting the message so that, like I said, if it gets intercepted, its content
will be invisible unless you have the private keys that we select here.
So we're encrypting it for ourselves so we can see it ourselves and we're also going to encrypt it for
others.
And like I said, the receiver is John, so I'm going to put John's key in here.
As you can see, you just have to click it and that's it.
I don't want to set a password, so I'm not going to tick this box.
And the output in here specifies where the encrypted message will be stored.
And as you can see, it's going to be stored in home amnesia pictures and it's going to be called 22
dot jpg dot jpg.
So that's how you know that it is encrypted.
So it's basically going to be stored in here in this same location.
So once we're happy, we're going to click, sign, encrypt.
It's going to ask us for the private key of David because we're signing it using the private key of
David.
So I'm going to input that click okay and perfect.
As you can see, it's telling us that the picture is signed and encrypted.
So we're going to click finish here.
And if you look in here in the directory that we selected, you can see that we have a new file with
the same name that we selected in the output.
So 22 dot jpg dot jpg And as you can see, we cannot see the content of this picture.
So nobody will be able to see the content of this picture unless they decrypt it using either the private
key of David or the private key of John.
These are the private keys that we selected when we encrypted the image.
So now we can go ahead and send this picture to John and you can be rest assured that nobody will be
able to see the content of this picture unless they have the private key of John.
Therefore, they should be the only person that is able to see it.
Now you can share it using any method of transferring files that we covered earlier.
I'm not going to waste your time showing you how to do that.
We already covered that.
So I'm going to pause the video and resume it after I transfer it to John's computer.
So we're here at John's computer and I've already downloaded the encrypted image.
As you can see, it's not visible.
Now, in order to see it, we're going to go to Cleopatra.
And as you can see, because I'm in John's computer, I've got the key pair for John.
I got the private and the public key, and I only have David's public key.
Now we want to decrypt a message or a file.
So we're going to click on Decrypt Verify in here, and we're going to select the image or the file
that we want to decrypt.
And it's stored in my downloads.
And this is the file right here.
Double click.
And as you can see, it's asking me for the passphrase for John's private key because this file was
encrypted using John's public key.
And in order to decrypt it, we need the private key.
So I'm going to input that very quickly.
And perfect.
As you can see, the operation is complete.
So the decryption is complete.
It's telling us that this was signed using David's key.
And if we click on the show audit log, you can see that we have a good signature from David.
So as we mentioned earlier, this is what we usually look for.
And basically this means that this file was signed using David's private key.
It verifies that David is the creator of the file, and it also verifies that the file did not get modified
since David created it.
That means we're happy with the file.
So we're going to close this.
And looking in here in the output field, it's telling us that the decrypted message is going to be
stored in the downloads directory, which is the directory that actually contains the original encrypted
message.
So we're happy with that.
We're going to say save all and perfect.
As you can see, we have the file in here decrypted.
So if we double click it, we'll be able to see the contents of the file.
Now we're using an image in this example, but you can use this method to decrypt any file, whether
it's an image, a word document, a PDF, a video.
It doesn't really matter.
You can use the exact same steps to encrypt and sign files, and this way it allows us to send the files
securely and make sure that no one is able to see it except the person that we're encrypting this file
for.
And it also allows that person to verify that this file was created by us and verify that this file
did not get modified since it was created by us.