WEBVTT

1
00:00:00.000 --> 00:00:01.230
<v Instructor>In this lesson,</v>

2
00:00:01.230 --> 00:00:04.020
we will learn about digital signatures.

3
00:00:04.020 --> 00:00:07.410
A digital signature is a cryptographic technique

4
00:00:07.410 --> 00:00:09.420
that ensures the authenticity

5
00:00:09.420 --> 00:00:12.630
and integrity of a message or document.

6
00:00:12.630 --> 00:00:17.370
It uses a pair of keys, a private key to sign the data

7
00:00:17.370 --> 00:00:21.480
and a corresponding public key to verify the signature.

8
00:00:21.480 --> 00:00:23.190
With a digital signature

9
00:00:23.190 --> 00:00:25.320
and the sender's public key,

10
00:00:25.320 --> 00:00:28.440
the signature recipient can confirm the identity

11
00:00:28.440 --> 00:00:29.640
of the sender

12
00:00:29.640 --> 00:00:31.230
and ensure the content

13
00:00:31.230 --> 00:00:34.860
of the digitally signed message has not been altered.

14
00:00:34.860 --> 00:00:37.380
Let's learn more about digital signatures

15
00:00:37.380 --> 00:00:38.970
and non-repudiation.

16
00:00:38.970 --> 00:00:42.420
Then let's do a walkthrough of a digital signature.

17
00:00:42.420 --> 00:00:44.940
First, we have digital signatures.

18
00:00:44.940 --> 00:00:47.970
Digital signatures ensure the authenticity

19
00:00:47.970 --> 00:00:52.290
and integrity of a message, document, or piece of data.

20
00:00:52.290 --> 00:00:55.830
They work by using a pair of cryptographic keys,

21
00:00:55.830 --> 00:00:59.490
a private key that is used to create the signature

22
00:00:59.490 --> 00:01:03.480
and a public key that is used to verify the signature.

23
00:01:03.480 --> 00:01:06.390
Let's walk through the digital signature process

24
00:01:06.390 --> 00:01:08.190
to better understand it.

25
00:01:08.190 --> 00:01:11.190
In our scenario, let's assume Alice wants

26
00:01:11.190 --> 00:01:14.310
to send Bob a digitally signed email.

27
00:01:14.310 --> 00:01:16.680
It's important to note that both Alice

28
00:01:16.680 --> 00:01:20.610
and Bob have their own public and private key pairs.

29
00:01:20.610 --> 00:01:24.270
So to create a digital signature for her email,

30
00:01:24.270 --> 00:01:28.170
Alice's email client will take her message for Bob

31
00:01:28.170 --> 00:01:33.170
and run it through a hashing algorithm such as SHA 256.

32
00:01:33.300 --> 00:01:36.480
This creates a unique hash digest

33
00:01:36.480 --> 00:01:39.480
that is based on Alice's message to Bob.

34
00:01:39.480 --> 00:01:43.410
Next Alice's email Client will use her private key

35
00:01:43.410 --> 00:01:47.580
to encrypt the hash digest, which again is a hash

36
00:01:47.580 --> 00:01:49.350
of her message to Bob.

37
00:01:49.350 --> 00:01:53.490
This encrypted hash digest is appended to her email

38
00:01:53.490 --> 00:01:56.340
and is known as a digital signature.

39
00:01:56.340 --> 00:02:01.320
Note, Alice did not encrypt her actual email message to Bob.

40
00:02:01.320 --> 00:02:05.100
That's because digital signatures focus on authenticity

41
00:02:05.100 --> 00:02:08.520
and integrity, not confidentiality.

42
00:02:08.520 --> 00:02:09.930
Back to our scenario.

43
00:02:09.930 --> 00:02:13.170
Bob's email client now receives the email

44
00:02:13.170 --> 00:02:16.800
and digital signature from Alice's email client.

45
00:02:16.800 --> 00:02:17.970
At this point,

46
00:02:17.970 --> 00:02:22.080
Bob's email client will decrypt Alice's digital signature,

47
00:02:22.080 --> 00:02:25.950
which remember, is an encrypted hash of her email.

48
00:02:25.950 --> 00:02:29.250
Bob's email client does this signature decryption

49
00:02:29.250 --> 00:02:33.030
with Alice's public key, which is publicly available.

50
00:02:33.030 --> 00:02:37.650
So Bob's email client decrypts Alice's digital signature,

51
00:02:37.650 --> 00:02:42.030
and the result is the hash digest of Alice's message

52
00:02:42.030 --> 00:02:44.760
that Alice's email client created.

53
00:02:44.760 --> 00:02:49.050
Now, Bob's email client takes Alice's email message

54
00:02:49.050 --> 00:02:51.870
and using the same hashing algorithm

55
00:02:51.870 --> 00:02:56.310
that Alice's email client used, he hashes Alice's email.

56
00:02:56.310 --> 00:02:58.800
If the calculated hash digest

57
00:02:58.800 --> 00:03:01.350
matches the received hash digest,

58
00:03:01.350 --> 00:03:05.070
then the email message was not modified in transit

59
00:03:05.070 --> 00:03:08.940
and the message integrity has not been compromised.

60
00:03:08.940 --> 00:03:10.980
But what about authenticity?

61
00:03:10.980 --> 00:03:14.190
How do we know that it was really Alice's email client

62
00:03:14.190 --> 00:03:15.720
that's signed the message?

63
00:03:15.720 --> 00:03:18.390
That's where non-repudiation comes in.

64
00:03:18.390 --> 00:03:22.020
And one of the key benefits of digital signatures is

65
00:03:22.020 --> 00:03:24.750
that they not only provide integrity,

66
00:03:24.750 --> 00:03:28.140
they also provide non-repudiation.

67
00:03:28.140 --> 00:03:31.740
So second, we have non-repudiation.

68
00:03:31.740 --> 00:03:33.330
Non-repudiation means

69
00:03:33.330 --> 00:03:36.360
that once a digital signature is created,

70
00:03:36.360 --> 00:03:41.190
the signer cannot later deny having signed the document.

71
00:03:41.190 --> 00:03:43.920
This is because the signature is created

72
00:03:43.920 --> 00:03:46.530
using the signer's private key,

73
00:03:46.530 --> 00:03:49.470
which only the signer has access to.

74
00:03:49.470 --> 00:03:54.420
After all, in our digital signature example, the only person

75
00:03:54.420 --> 00:03:56.970
who could have encrypted Alice's email

76
00:03:56.970 --> 00:03:59.550
with her private key was Alice.

77
00:03:59.550 --> 00:04:03.300
This is because Alice keeps her private key private.

78
00:04:03.300 --> 00:04:04.950
It is never shared.

79
00:04:04.950 --> 00:04:09.750
So at email receipt, Bob can determine that Alice had

80
00:04:09.750 --> 00:04:12.960
to be the one to encrypt the digital signature

81
00:04:12.960 --> 00:04:15.810
because he can use Alice's public key

82
00:04:15.810 --> 00:04:18.540
to decrypt the digital signature.

83
00:04:18.540 --> 00:04:21.120
And in asymmetric encryption,

84
00:04:21.120 --> 00:04:25.140
a public key can only decrypt something that was encrypted

85
00:04:25.140 --> 00:04:27.540
by the associated private key.

86
00:04:27.540 --> 00:04:31.140
So Bob decrypts Alice's digital signature

87
00:04:31.140 --> 00:04:33.000
using her public key,

88
00:04:33.000 --> 00:04:37.020
providing both integrity and non-repudiation.

89
00:04:37.020 --> 00:04:40.950
But if Alice also wants to provide confidentiality,

90
00:04:40.950 --> 00:04:43.800
she will need to encrypt the message itself.

91
00:04:43.800 --> 00:04:47.370
And this can be done using Bob's public key.

92
00:04:47.370 --> 00:04:49.830
This works because if something is encrypted

93
00:04:49.830 --> 00:04:52.530
with Bob's public key, then only Bob

94
00:04:52.530 --> 00:04:54.810
with his private key can decrypt it.

95
00:04:54.810 --> 00:04:57.720
And since Bob keeps his private key private,

96
00:04:57.720 --> 00:05:00.810
the confidentiality of the message from Alice

97
00:05:00.810 --> 00:05:02.760
to Bob is assured.

98
00:05:02.760 --> 00:05:05.520
This is where people get a bit confused.

99
00:05:05.520 --> 00:05:09.180
So you may need to remember that to provide privacy

100
00:05:09.180 --> 00:05:12.750
and confidentiality, the receiver's public key,

101
00:05:12.750 --> 00:05:15.120
that's Bob's public key, is used

102
00:05:15.120 --> 00:05:16.920
to encrypt the message.

103
00:05:16.920 --> 00:05:19.410
To ensure the integrity of the message,

104
00:05:19.410 --> 00:05:23.520
Alice needs to hash it to create a hash digest.

105
00:05:23.520 --> 00:05:26.220
And to ensure authenticity of the message

106
00:05:26.220 --> 00:05:27.840
through non-repudiation,

107
00:05:27.840 --> 00:05:31.500
Alice needs to encrypt the hash digest of her message

108
00:05:31.500 --> 00:05:33.180
with her private key.

109
00:05:33.180 --> 00:05:36.570
If all three actions are taken, we call this encrypting

110
00:05:36.570 --> 00:05:39.030
and digitally signing the message.

111
00:05:39.030 --> 00:05:42.840
Most email clients can be configured to support this

112
00:05:42.840 --> 00:05:44.610
as long as you have public

113
00:05:44.610 --> 00:05:48.630
and private key pairs assigned to all your users.

114
00:05:48.630 --> 00:05:53.220
Now using OpenSSL, let's walk through a demonstration

115
00:05:53.220 --> 00:05:55.230
of a digital signature.

116
00:05:55.230 --> 00:05:58.860
In the real world, this process would be done for you,

117
00:05:58.860 --> 00:06:02.730
but it's important to understand academically how each

118
00:06:02.730 --> 00:06:04.350
of these steps would occur.

119
00:06:04.350 --> 00:06:07.440
So we'll walk through the process manually.

120
00:06:07.440 --> 00:06:09.060
Again, our scenario

121
00:06:09.060 --> 00:06:12.960
will be Alice sending a digital signature to Bob.

122
00:06:12.960 --> 00:06:14.790
In the real world to start off,

123
00:06:14.790 --> 00:06:17.790
both Alice and Bob would already have public

124
00:06:17.790 --> 00:06:19.590
and private key pairs.

125
00:06:19.590 --> 00:06:21.510
In this case, they don't.

126
00:06:21.510 --> 00:06:24.330
But for a digital signature, we're only going

127
00:06:24.330 --> 00:06:27.570
to need Alice's public and private key pair.

128
00:06:27.570 --> 00:06:29.430
So let's create those.

129
00:06:29.430 --> 00:06:33.150
We'll start by creating Alice's private key

130
00:06:33.150 --> 00:06:36.843
using this OpenSSL command.

131
00:06:39.810 --> 00:06:41.280
And it's created.

132
00:06:41.280 --> 00:06:44.400
Then we'll create Alice's public key,

133
00:06:44.400 --> 00:06:49.400
alice_public.key from Alice's private key,

134
00:06:49.740 --> 00:06:51.963
which is called alice_private.key.

135
00:06:57.300 --> 00:06:58.890
There we go.

136
00:06:58.890 --> 00:07:02.880
Now, the first step in the digital signature process

137
00:07:02.880 --> 00:07:06.690
is Alice creating a message to send to Bob.

138
00:07:06.690 --> 00:07:09.210
We'll do this using the echo command

139
00:07:09.210 --> 00:07:11.920
and create a file called alice_message.txt

140
00:07:14.580 --> 00:07:18.063
that just says, this is Alice's message to Bob.

141
00:07:19.650 --> 00:07:23.880
Next, we need to create Alice's digital signature.

142
00:07:23.880 --> 00:07:28.350
This will require hashing Alice's alice_message.txt file,

143
00:07:29.790 --> 00:07:30.810
and signing it

144
00:07:30.810 --> 00:07:34.507
with Alice's private key called Alice_private.key.

145
00:07:36.630 --> 00:07:38.940
This is done in one step,

146
00:07:38.940 --> 00:07:43.407
and the result will be a file called alice_signature.bin

147
00:07:45.870 --> 00:07:49.860
where bin stands for binary, which is the format

148
00:07:49.860 --> 00:07:52.173
that the signature file will be in.

149
00:07:55.140 --> 00:07:56.820
And it's created.

150
00:07:56.820 --> 00:08:01.327
Now Alice would send her alice_message.txt file

151
00:08:03.360 --> 00:08:05.670
along with her digital signature,

152
00:08:05.670 --> 00:08:09.840
the alice_signature.bin file

153
00:08:09.840 --> 00:08:14.840
and her public key, alice_public.key to Bob.

154
00:08:15.390 --> 00:08:17.010
With all of that in hand,

155
00:08:17.010 --> 00:08:21.960
Bob will decrypt the alice_signature.bin file

156
00:08:21.960 --> 00:08:25.950
with the alice_public.key file.

157
00:08:25.950 --> 00:08:28.530
The result will be the hash digest

158
00:08:28.530 --> 00:08:33.530
of the alice_message.txt file that Alice created.

159
00:08:34.110 --> 00:08:38.610
Then Bob will take the alice_message.txt file

160
00:08:38.610 --> 00:08:40.170
that Alice sent him,

161
00:08:40.170 --> 00:08:43.140
and he will hash it with the same hashing algorithm

162
00:08:43.140 --> 00:08:46.713
that Alice used, in this case, SHA 256.

163
00:08:47.610 --> 00:08:50.580
At this point, Bob has the hash

164
00:08:50.580 --> 00:08:54.120
of the alice_message.txt file

165
00:08:54.120 --> 00:08:57.990
that Alice created and the one that he created.

166
00:08:57.990 --> 00:08:59.820
So he compares them.

167
00:08:59.820 --> 00:09:04.260
If they are the same, the digital signature is verified OK

168
00:09:04.260 --> 00:09:08.010
and the integrity of the message is validated.

169
00:09:08.010 --> 00:09:12.123
This will all happen in one OpenSSL command.

170
00:09:15.360 --> 00:09:20.173
As you can see, the digital signature has been verified OK.

171
00:09:21.360 --> 00:09:24.600
This is the end of our demonstration.

172
00:09:24.600 --> 00:09:26.610
So remember,

173
00:09:26.610 --> 00:09:30.480
digital signatures are a cryptographic method used

174
00:09:30.480 --> 00:09:34.350
to ensure authenticity and integrity of data.

175
00:09:34.350 --> 00:09:37.770
They use a pair of keys, a private key

176
00:09:37.770 --> 00:09:39.780
to create the signature

177
00:09:39.780 --> 00:09:42.810
and a public key to verify it, confirming

178
00:09:42.810 --> 00:09:45.630
that the data has not been altered.

179
00:09:45.630 --> 00:09:49.740
Digital signatures also provide non-repudiation,

180
00:09:49.740 --> 00:09:53.610
meaning the signer cannot deny having signed the data

181
00:09:53.610 --> 00:09:56.910
because the signature was created with their private key,

182
00:09:56.910 --> 00:09:59.280
which only they possess.

183
00:09:59.280 --> 00:10:02.310
While digital signatures ensure authenticity

184
00:10:02.310 --> 00:10:06.300
and integrity, they do not provide confidentiality.

185
00:10:06.300 --> 00:10:07.530
To achieve that,

186
00:10:07.530 --> 00:10:10.050
the message itself must be encrypted

187
00:10:10.050 --> 00:10:12.840
using the recipient's public key.

188
00:10:12.840 --> 00:10:16.290
Combining these techniques, digital signatures

189
00:10:16.290 --> 00:10:18.450
for authenticity and integrity

190
00:10:18.450 --> 00:10:22.020
and encryption for confidentiality, creates a secure

191
00:10:22.020 --> 00:10:25.143
and trustworthy communication process.

