1 00:00:00,000 --> 00:00:06,000 Previously, we learned how to securely and privately send messages over the Internet. 2 00:00:06,000 --> 00:00:10,000 And we did this by encrypting and signing the message before sending it. 3 00:00:10,000 --> 00:00:17,000 This ensures that nobody can read the message except the sender that we encrypt the message for. 4 00:00:17,000 --> 00:00:22,000 And it also allows the sender to first of all, verify the integrity of the message, make sure that 5 00:00:22,000 --> 00:00:28,000 we are the senders and also using the signature, they can ensure that the message was not modified 6 00:00:28,000 --> 00:00:30,000 as it was transmitted. 7 00:00:30,000 --> 00:00:36,000 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 8 00:00:36,000 --> 00:00:38,000 want to cover in this lecture. 9 00:00:38,000 --> 00:00:44,000 So in this lecture I'm going to show you how to sign, encrypt and decrypt files so that we can securely 10 00:00:44,000 --> 00:00:50,000 and privately send them over the Internet and make sure that they can only be seen by the person that 11 00:00:50,000 --> 00:00:56,000 we're sending this file to and also allow that person to verify the integrity of the message and verify 12 00:00:56,000 --> 00:00:57,000 the sender. 13 00:00:57,000 --> 00:00:59,000 Now, doing this is very easy. 14 00:00:59,000 --> 00:01:02,000 Right here I am in David's computer. 15 00:01:02,000 --> 00:01:05,000 This is the file, the image that I want to send. 16 00:01:05,000 --> 00:01:08,000 And I have Cleopatra running in here. 17 00:01:08,000 --> 00:01:14,000 As you can see, I have David's private and public key because, like I said, this is David's computer 18 00:01:14,000 --> 00:01:19,000 and I only have John's public key because John is the person that I'm going to be sending this message 19 00:01:19,000 --> 00:01:20,000 to. 20 00:01:20,000 --> 00:01:21,000 So he's the receiver. 21 00:01:22,000 --> 00:01:25,000 Now, the file right here, as you can see, it's visible. 22 00:01:25,000 --> 00:01:25,000 It works. 23 00:01:25,000 --> 00:01:27,000 It's a picture of me and my cat. 24 00:01:27,000 --> 00:01:33,000 And what we want to do is we want to encrypt this so that the content of this image is invisible to 25 00:01:33,000 --> 00:01:39,000 anybody that does not have the private key of John, because I'm going to be sending this to John. 26 00:01:39,000 --> 00:01:41,000 Now, doing this is very easy. 27 00:01:41,000 --> 00:01:46,000 We're simply going to go back to Cleopatra and we're going to click on Sign Encrypt. 28 00:01:46,000 --> 00:01:51,000 It's going to ask me to select the file that I want to sign or encrypt. 29 00:01:51,000 --> 00:01:54,000 So we're going to go to Amnesia pictures. 30 00:01:54,000 --> 00:01:55,000 That's what I have the picture. 31 00:01:55,000 --> 00:01:57,000 And this is the picture right here. 32 00:01:57,000 --> 00:01:58,000 22 dot JPG. 33 00:01:58,000 --> 00:02:04,000 You should also remove all metadata from this picture and I cover that earlier in the course. 34 00:02:04,000 --> 00:02:07,000 So right now this picture is ready to be encrypted. 35 00:02:07,000 --> 00:02:13,000 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 36 00:02:13,000 --> 00:02:14,000 text. 37 00:02:14,000 --> 00:02:18,000 So first of all, it's asking us who do we want to sign this picture as? 38 00:02:18,000 --> 00:02:22,000 So we're going to be using our private key to sign it. 39 00:02:22,000 --> 00:02:25,000 This allows John to verify the sender of the message. 40 00:02:25,000 --> 00:02:31,000 We're also going to be encrypting the message so that, like I said, if it gets intercepted, its content 41 00:02:31,000 --> 00:02:35,000 will be invisible unless you have the private keys that we select here. 42 00:02:35,000 --> 00:02:41,000 So we're encrypting it for ourselves so we can see it ourselves and we're also going to encrypt it for 43 00:02:41,000 --> 00:02:42,000 others. 44 00:02:42,000 --> 00:02:47,000 And like I said, the receiver is John, so I'm going to put John's key in here. 45 00:02:47,000 --> 00:02:50,000 As you can see, you just have to click it and that's it. 46 00:02:50,000 --> 00:02:53,000 I don't want to set a password, so I'm not going to tick this box. 47 00:02:53,000 --> 00:02:59,000 And the output in here specifies where the encrypted message will be stored. 48 00:02:59,000 --> 00:03:04,000 And as you can see, it's going to be stored in home amnesia pictures and it's going to be called 22 49 00:03:04,000 --> 00:03:07,000 dot jpg dot jpg. 50 00:03:07,000 --> 00:03:09,000 So that's how you know that it is encrypted. 51 00:03:09,000 --> 00:03:12,000 So it's basically going to be stored in here in this same location. 52 00:03:13,000 --> 00:03:17,000 So once we're happy, we're going to click, sign, encrypt. 53 00:03:17,000 --> 00:03:23,000 It's going to ask us for the private key of David because we're signing it using the private key of 54 00:03:23,000 --> 00:03:23,000 David. 55 00:03:24,000 --> 00:03:29,000 So I'm going to input that click okay and perfect. 56 00:03:29,000 --> 00:03:33,000 As you can see, it's telling us that the picture is signed and encrypted. 57 00:03:33,000 --> 00:03:35,000 So we're going to click finish here. 58 00:03:35,000 --> 00:03:42,000 And if you look in here in the directory that we selected, you can see that we have a new file with 59 00:03:42,000 --> 00:03:45,000 the same name that we selected in the output. 60 00:03:45,000 --> 00:03:51,000 So 22 dot jpg dot jpg And as you can see, we cannot see the content of this picture. 61 00:03:51,000 --> 00:03:57,000 So nobody will be able to see the content of this picture unless they decrypt it using either the private 62 00:03:57,000 --> 00:04:00,000 key of David or the private key of John. 63 00:04:00,000 --> 00:04:03,000 These are the private keys that we selected when we encrypted the image. 64 00:04:04,000 --> 00:04:11,000 So now we can go ahead and send this picture to John and you can be rest assured that nobody will be 65 00:04:11,000 --> 00:04:15,000 able to see the content of this picture unless they have the private key of John. 66 00:04:15,000 --> 00:04:19,000 Therefore, they should be the only person that is able to see it. 67 00:04:19,000 --> 00:04:23,000 Now you can share it using any method of transferring files that we covered earlier. 68 00:04:23,000 --> 00:04:26,000 I'm not going to waste your time showing you how to do that. 69 00:04:26,000 --> 00:04:27,000 We already covered that. 70 00:04:27,000 --> 00:04:32,000 So I'm going to pause the video and resume it after I transfer it to John's computer. 71 00:04:32,000 --> 00:04:37,000 So we're here at John's computer and I've already downloaded the encrypted image. 72 00:04:37,000 --> 00:04:39,000 As you can see, it's not visible. 73 00:04:39,000 --> 00:04:42,000 Now, in order to see it, we're going to go to Cleopatra. 74 00:04:42,000 --> 00:04:47,000 And as you can see, because I'm in John's computer, I've got the key pair for John. 75 00:04:47,000 --> 00:04:51,000 I got the private and the public key, and I only have David's public key. 76 00:04:51,000 --> 00:04:55,000 Now we want to decrypt a message or a file. 77 00:04:55,000 --> 00:05:01,000 So we're going to click on Decrypt Verify in here, and we're going to select the image or the file 78 00:05:01,000 --> 00:05:02,000 that we want to decrypt. 79 00:05:02,000 --> 00:05:04,000 And it's stored in my downloads. 80 00:05:04,000 --> 00:05:06,000 And this is the file right here. 81 00:05:06,000 --> 00:05:07,000 Double click. 82 00:05:08,000 --> 00:05:14,000 And as you can see, it's asking me for the passphrase for John's private key because this file was 83 00:05:14,000 --> 00:05:17,000 encrypted using John's public key. 84 00:05:17,000 --> 00:05:19,000 And in order to decrypt it, we need the private key. 85 00:05:19,000 --> 00:05:22,000 So I'm going to input that very quickly. 86 00:05:24,000 --> 00:05:24,000 And perfect. 87 00:05:24,000 --> 00:05:27,000 As you can see, the operation is complete. 88 00:05:27,000 --> 00:05:29,000 So the decryption is complete. 89 00:05:29,000 --> 00:05:34,000 It's telling us that this was signed using David's key. 90 00:05:34,000 --> 00:05:40,000 And if we click on the show audit log, you can see that we have a good signature from David. 91 00:05:40,000 --> 00:05:43,000 So as we mentioned earlier, this is what we usually look for. 92 00:05:43,000 --> 00:05:49,000 And basically this means that this file was signed using David's private key. 93 00:05:49,000 --> 00:05:57,000 It verifies that David is the creator of the file, and it also verifies that the file did not get modified 94 00:05:57,000 --> 00:05:58,000 since David created it. 95 00:05:58,000 --> 00:06:00,000 That means we're happy with the file. 96 00:06:00,000 --> 00:06:02,000 So we're going to close this. 97 00:06:02,000 --> 00:06:09,000 And looking in here in the output field, it's telling us that the decrypted message is going to be 98 00:06:09,000 --> 00:06:14,000 stored in the downloads directory, which is the directory that actually contains the original encrypted 99 00:06:14,000 --> 00:06:15,000 message. 100 00:06:15,000 --> 00:06:17,000 So we're happy with that. 101 00:06:17,000 --> 00:06:20,000 We're going to say save all and perfect. 102 00:06:20,000 --> 00:06:24,000 As you can see, we have the file in here decrypted. 103 00:06:24,000 --> 00:06:28,000 So if we double click it, we'll be able to see the contents of the file. 104 00:06:28,000 --> 00:06:35,000 Now we're using an image in this example, but you can use this method to decrypt any file, whether 105 00:06:35,000 --> 00:06:39,000 it's an image, a word document, a PDF, a video. 106 00:06:39,000 --> 00:06:41,000 It doesn't really matter. 107 00:06:41,000 --> 00:06:48,000 You can use the exact same steps to encrypt and sign files, and this way it allows us to send the files 108 00:06:48,000 --> 00:06:54,000 securely and make sure that no one is able to see it except the person that we're encrypting this file 109 00:06:54,000 --> 00:06:54,000 for. 110 00:06:54,000 --> 00:07:00,000 And it also allows that person to verify that this file was created by us and verify that this file 111 00:07:00,000 --> 00:07:04,000 did not get modified since it was created by us.