WEBVTT - This file was automatically generated by VIMEO

0
00:00:08.600 --> 00:00:11.500
Chapter 2 is about cryptography and

1
00:00:11.500 --> 00:00:12.500
 Technology details.

2
00:00:13.600 --> 00:00:16.500
Our objectives are to make sure you fully understand the

3
00:00:16.500 --> 00:00:18.700
 cryptography necessary for blockchain.

4
00:00:19.600 --> 00:00:22.300
Have a deeper understanding of hashes and digital signatures.

5
00:00:23.200 --> 00:00:26.000
As well as understand how these relate to nodes in the blockchain.

6
00:00:26.900 --> 00:00:29.000
Obviously a single lesson is not

7
00:00:29.200 --> 00:00:32.300
 going to make you an expert in cryptography, but you

8
00:00:32.300 --> 00:00:35.300
 do need a deeper knowledge than other people

9
00:00:35.300 --> 00:00:37.900
 working in blockchain if you wish to be a developer.

10
00:00:39.300 --> 00:00:42.400
Let's start with cryptographic hashes. Now in lesson

11
00:00:42.400 --> 00:00:45.200
 one, we gave you an overview of the properties required for

12
00:00:45.200 --> 00:00:46.400
 cryptographic hash.

13
00:00:47.200 --> 00:00:49.200
But there are many different algorithms to choose from.

14
00:00:50.600 --> 00:00:53.200
Charm one has long since been considered no longer

15
00:00:53.200 --> 00:00:54.900
 viable and secure.

16
00:00:55.400 --> 00:00:58.500
Sha2 has two primary sizes at

17
00:00:58.500 --> 00:01:01.600
 256 bit and a 512 bit.

18
00:01:02.600 --> 00:01:05.900
There are also truncated versions such as shot 224

19
00:01:05.900 --> 00:01:08.300
 and shot 384. These are all designed

20
00:01:08.300 --> 00:01:09.600
 by the National Security Agency.

21
00:01:10.500 --> 00:01:14.500
The shot two is still something you can use it still

22
00:01:14.500 --> 00:01:15.200
 considered secure.

23
00:01:16.200 --> 00:01:20.100
But in October of 2012 there was

24
00:01:19.100 --> 00:01:22.200
 a into a competition to find

25
00:01:22.200 --> 00:01:25.900
 a Shaw 3 not to shawtu is wrong or insecure,

26
00:01:25.900 --> 00:01:29.000
 but just to be ready for the future the kekak

27
00:01:28.400 --> 00:01:31.200
 algorithm was selected as the winner of that

28
00:01:31.200 --> 00:01:32.600
 hash function competition.

29
00:01:33.600 --> 00:01:36.900
Shaw 3 uses something called a sponge contraction construction

30
00:01:36.900 --> 00:01:39.900
 and the message blocks or exclusively

31
00:01:39.900 --> 00:01:42.500
 ordered to the initial bits of the state. Now. This

32
00:01:42.500 --> 00:01:45.500
 has a totally different mathematical structure

33
00:01:45.500 --> 00:01:49.300
 than shot two or Shaw one and it

34
00:01:48.300 --> 00:01:51.700
 can also have variable size output.

35
00:01:51.700 --> 00:01:54.400
 Now that doesn't mean that when you put in an input

36
00:01:54.400 --> 00:01:57.100
 each time, you'll have different output size. It means

37
00:01:57.100 --> 00:02:01.000
 you as the implementer of Shaw 3 get to pick what size

38
00:02:00.200 --> 00:02:01.300
 you want.

39
00:02:02.500 --> 00:02:05.200
There are a lot of hashes out there the ones you see in bold

40
00:02:05.200 --> 00:02:06.900
 are the ones most common in the United States.

41
00:02:07.800 --> 00:02:10.300
Ntlm and ntlm version 2 are used

42
00:02:10.300 --> 00:02:13.100
 exclusively for Windows password authentication.

43
00:02:14.300 --> 00:02:17.500
Around the world. You'll see many others like rightmd have all

44
00:02:17.500 --> 00:02:18.000
 and tiger.

45
00:02:18.700 --> 00:02:21.900
Before you select a particular hash algorithm. The

46
00:02:21.900 --> 00:02:24.400
 best thing to do is simply do a little research on

47
00:02:24.400 --> 00:02:27.400
 is it known to be secure are there known issues with

48
00:02:27.400 --> 00:02:28.600
 it that sort of thing?

49
00:02:30.800 --> 00:02:33.500
Now in addition to hashes, there's something called a

50
00:02:33.500 --> 00:02:36.500
 message authentication code. The idea here

51
00:02:36.500 --> 00:02:39.600
 is to have something in addition to the hatch to work

52
00:02:39.600 --> 00:02:42.300
 together with it. The most common is a hash

53
00:02:42.300 --> 00:02:45.600
 message authentication code what happens there is

54
00:02:45.600 --> 00:02:48.600
 the parties involved exchange a

55
00:02:48.600 --> 00:02:50.300
 random string of bits.

56
00:02:51.400 --> 00:02:54.600
In each time Ash is calculated. It's then exclusively

57
00:02:54.600 --> 00:02:57.500
 ordered that random string of bits. So to

58
00:02:57.500 --> 00:03:00.500
 recreate the hash you would have to also have that random

59
00:03:00.500 --> 00:03:01.800
 string of bits a key.

60
00:03:02.600 --> 00:03:03.700
Another way to do this.

61
00:03:05.200 --> 00:03:08.600
Is Cypher blockchaining with message authentication code? You

62
00:03:08.600 --> 00:03:12.100
 essentially use a traditional symmetric Cipher with

63
00:03:11.100 --> 00:03:14.300
 Cipher block chaining and then

64
00:03:14.300 --> 00:03:17.900
 you only produce the final block as your hash equivalent

65
00:03:17.900 --> 00:03:20.800
 both of these methods both basically

66
00:03:20.800 --> 00:03:23.800
 incorporate a key with hashing to

67
00:03:23.800 --> 00:03:25.000
 make it a little more secure.

68
00:03:26.300 --> 00:03:26.900
Now we mentioned.

69
00:03:28.300 --> 00:03:31.500
Collisions in the first lesson, basically if

70
00:03:31.500 --> 00:03:34.600
 two different inputs produce the same output and

71
00:03:34.600 --> 00:03:37.600
 you see here password a and password B produce the

72
00:03:37.600 --> 00:03:40.300
 same output. Then you have a collision one of

73
00:03:40.300 --> 00:03:43.800
 the things you'd like to investigate When selecting a hashing algorithm

74
00:03:43.800 --> 00:03:46.500
 is how resistant is it to collisions?

75
00:03:47.600 --> 00:03:50.600
Most of the ones I've listed are very very resistant. You're

76
00:03:50.600 --> 00:03:53.200
 highly unlikely to ever find a collision. But if you want to

77
00:03:53.200 --> 00:03:56.000
 try a new algorithm, you'll have to investigate that issue.

78
00:03:57.300 --> 00:04:01.500
Related to hashes is a thing called the birthday Paradox. Now

79
00:04:00.500 --> 00:04:03.500
 this might seem totally in a

80
00:04:03.500 --> 00:04:05.300
 different track for just a moment prepare with me.

81
00:04:06.400 --> 00:04:09.100
How many people would you need to have in a room to have

82
00:04:09.100 --> 00:04:12.800
 a strong likelihood better than 50% The two

83
00:04:12.800 --> 00:04:15.400
 would have the same birthday and by that I mean month and day

84
00:04:15.400 --> 00:04:16.500
 I don't mean you.

85
00:04:18.400 --> 00:04:21.900
Now if you put 367 people in the room, at least

86
00:04:21.900 --> 00:04:24.800
 two of the must have the same birthday since there

87
00:04:24.800 --> 00:04:27.400
 are 365 days in the air plus one more for

88
00:04:27.400 --> 00:04:31.600
 leap year the 367th person must match

89
00:04:30.600 --> 00:04:32.600
 at least one of the others.

90
00:04:33.500 --> 00:04:36.700
Now this is not asking how many people you need to guarantee a

91
00:04:36.700 --> 00:04:36.900
 match?

92
00:04:37.500 --> 00:04:40.600
It's asking how many people you need to have a strong probability of

93
00:04:40.600 --> 00:04:41.100
 a match.

94
00:04:41.800 --> 00:04:44.100
It turns out and we'll show you the math in just a

95
00:04:44.100 --> 00:04:44.100
 moment.

96
00:04:44.900 --> 00:04:47.100
But with even 23 people in a room.

97
00:04:47.900 --> 00:04:50.100
You have a 50% chance that two will

98
00:04:50.100 --> 00:04:53.300
 have the same birthday. Now. What does this have to do with hashes?

99
00:04:54.100 --> 00:04:57.400
It's about producing collisions some types of attacks.

100
00:04:57.900 --> 00:04:59.600
Try to create a collision.

101
00:05:00.300 --> 00:05:02.100
in order to match a hash

102
00:05:02.700 --> 00:05:05.200
You can't unhash something. You learned that in lesson one,

103
00:05:05.200 --> 00:05:07.000
 but you can try to create a collision.

104
00:05:08.900 --> 00:05:11.000
What the birth they Paradox is telling you.

105
00:05:11.300 --> 00:05:12.800
 It's a collision and birthdays.

106
00:05:13.300 --> 00:05:16.100
And what we're saying is that you're going to need a lot

107
00:05:16.100 --> 00:05:19.400
 less than you might think to create a collision which is

108
00:05:19.400 --> 00:05:22.700
 why generally if the hashing algorithm is sound

109
00:05:22.700 --> 00:05:25.200
 the larger the hash the better. So if you

110
00:05:25.200 --> 00:05:28.700
 have a chance to use Shaw 2 with 512 bits.

111
00:05:29.600 --> 00:05:32.500
Instead of 256 that's better. But now

112
00:05:32.500 --> 00:05:35.400
 let's explain the math on this 23 people. You might

113
00:05:35.400 --> 00:05:36.200
 be doubting that.

114
00:05:37.800 --> 00:05:40.100
Let's say the very first person comes in the

115
00:05:40.100 --> 00:05:40.200
 room.

116
00:05:41.100 --> 00:05:44.400
Now since they're the first person there's a 100% chance

117
00:05:44.400 --> 00:05:47.400
 that they don't share a birthday with anyone else in the

118
00:05:47.400 --> 00:05:50.300
 room because there's no one else in the room and if we want to write this

119
00:05:50.300 --> 00:05:51.300
 as days in a year.

120
00:05:52.100 --> 00:05:55.200
for getting about leap year for a moment 100% is the same

121
00:05:55.200 --> 00:05:57.300
 as 365 over 365

122
00:05:58.600 --> 00:06:01.500
Now the next person comes to the room the odds that

123
00:06:01.500 --> 00:06:04.300
 person has a birthday different from the first one.

124
00:06:05.200 --> 00:06:08.300
Or 364 at a 365 pretty high as

125
00:06:08.300 --> 00:06:12.200
 we would expect the third person is 363 out

126
00:06:11.200 --> 00:06:14.100
 of 365. Well, you can

127
00:06:14.100 --> 00:06:17.100
 convert those into percentages as you see

128
00:06:17.100 --> 00:06:20.500
 here and once we get to the 23rd person

129
00:06:21.900 --> 00:06:24.300
There's only a 49% chance that they

130
00:06:24.300 --> 00:06:27.400
 don't match someone in the room, which means there's a

131
00:06:27.400 --> 00:06:29.700
 51% chance that they do.

132
00:06:30.600 --> 00:06:33.600
Now this goes back to the odds of two inputs

133
00:06:33.600 --> 00:06:36.300
 to a hash with the same output or Collision.

134
00:06:37.300 --> 00:06:38.400
Now just to be clear.

135
00:06:39.200 --> 00:06:43.100
We're not saying that the size of the hash is the only consideration the

136
00:06:42.100 --> 00:06:45.200
 robustness of the algorithm is also clearly important.

137
00:06:46.100 --> 00:06:50.300
But the size will play a role in resisting collisions.

138
00:06:51.700 --> 00:06:54.300
Now when we talk about cryptography, we have

139
00:06:54.300 --> 00:06:57.600
 two main types of cryptography symmetric and asymmetric.

140
00:06:58.200 --> 00:06:59.300
symmetric means

141
00:07:00.100 --> 00:07:03.400
you and I share a key and I'll use a key to encrypt and

142
00:07:03.400 --> 00:07:05.000
 you'll use the same key to decrypt.

143
00:07:05.500 --> 00:07:08.800
DS was probably the most widely known but long

144
00:07:08.800 --> 00:07:10.700
 since considered outdated and insecure.

145
00:07:11.600 --> 00:07:13.800
AES for advanced encryption standard

146
00:07:15.500 --> 00:07:18.600
is probably the most widely known and used symmetric Cipher

147
00:07:18.600 --> 00:07:21.600
 today. It was built on the reindel Block Cipher.

148
00:07:21.600 --> 00:07:26.100
 You can choose three different key sizes 128 192

149
00:07:24.100 --> 00:07:27.400
 or 200 56 bit.

150
00:07:28.600 --> 00:07:31.600
Blowfish is another one. You'll see quite frequently was designed

151
00:07:31.600 --> 00:07:34.500
 by Bruce schneier. All of Bruce schneier's output

152
00:07:34.500 --> 00:07:37.800
 is released with no copyright no patent free for

153
00:07:37.800 --> 00:07:40.100
 anyone to use. So you see algorithms like this

154
00:07:40.100 --> 00:07:41.800
 a lot in open source Solutions

155
00:07:42.500 --> 00:07:45.500
Now his has varying key lengths you

156
00:07:45.500 --> 00:07:49.200
 can choose key sizes and 32-bit increments from 32-bit

157
00:07:48.200 --> 00:07:50.400
 up to 448 bit.

158
00:07:52.400 --> 00:07:55.800
Serpent is another one. It has a structure

159
00:07:55.800 --> 00:07:59.600
 almost identical to AES and

160
00:07:58.600 --> 00:08:01.800
 it has key sizes of 128 192

161
00:08:01.800 --> 00:08:03.600
 and 256 just like AES.

162
00:08:04.400 --> 00:08:07.400
But the one of the main differences is with AES.

163
00:08:08.300 --> 00:08:11.700
Each symmetric Cipher will go through a certain number of rounds and

164
00:08:11.700 --> 00:08:14.300
 each round is basically encrypting and encrypting and encrypting

165
00:08:14.300 --> 00:08:17.300
 again, for example, DS uses 16 rounds.

166
00:08:17.900 --> 00:08:20.400
AES will use 10 Rounds with

167
00:08:20.400 --> 00:08:21.700
 128 bit key.

168
00:08:22.700 --> 00:08:25.200
12 rounds with the 192 bit

169
00:08:25.200 --> 00:08:28.800
 key and 14 rounds with 256 bit but serpent

170
00:08:28.800 --> 00:08:31.400
 uses 32 rounds regardless of the key size.

171
00:08:33.200 --> 00:08:36.200
Now let's talk about asymmetric cryptography which is used in

172
00:08:36.200 --> 00:08:39.000
 digital signatures, which we see a lot in blockchain.

173
00:08:39.900 --> 00:08:43.200
Basically, there are two different keys that are mathematically related.

174
00:08:44.100 --> 00:08:47.100
So that one if it's used to encrypt a message

175
00:08:47.100 --> 00:08:48.600
 cannot decrypt the message.

176
00:08:49.800 --> 00:08:52.300
The other key is used to decrypt it.

177
00:08:52.300 --> 00:08:55.200
 So for example, I put out my public key and I

178
00:08:55.200 --> 00:08:58.500
 would not care. If every single person on the planet had a

179
00:08:58.500 --> 00:08:58.700
 copy of it.

180
00:08:59.200 --> 00:09:01.600
You can only be used to encrypt messages to me.

181
00:09:02.400 --> 00:09:05.400
You can't decrypt them only my private key that I keep secret

182
00:09:05.400 --> 00:09:06.900
 can decrypt them.

183
00:09:07.400 --> 00:09:10.300
Now in general asymmetric algorithms are slower than

184
00:09:10.300 --> 00:09:10.900
 symmetric.

185
00:09:11.400 --> 00:09:15.100
But they allow us to securely communicate without having

186
00:09:14.100 --> 00:09:16.300
 to pre-exchange a key.

187
00:09:18.100 --> 00:09:21.300
It works kind of like this if Alice would like to send Bob

188
00:09:21.300 --> 00:09:24.300
 a message see first gets Bob's public

189
00:09:24.300 --> 00:09:24.600
 key.

190
00:09:25.300 --> 00:09:28.100
Encrypts the message with Bob's public key and sends it to

191
00:09:28.100 --> 00:09:28.200
 him.

192
00:09:28.900 --> 00:09:31.500
Bob then decrypts the message with Bob's private

193
00:09:31.500 --> 00:09:31.600
 key.

194
00:09:32.100 --> 00:09:35.100
Now if Eve intercepts the message, even if she

195
00:09:35.100 --> 00:09:38.300
 has Bob's public key, it won't decrypt the

196
00:09:38.300 --> 00:09:39.600
 message only his private key will.

197
00:09:40.400 --> 00:09:41.800
Now when Bob is ready to respond.

198
00:09:43.100 --> 00:09:47.300
He wants to send a message back to Alice. He gets Alice's public key encrypts

199
00:09:46.300 --> 00:09:49.600
 the message sends it and then she'll decrypt

200
00:09:49.600 --> 00:09:50.600
 it with her private key.

201
00:09:52.800 --> 00:09:54.100
There are much fewer.

202
00:09:54.700 --> 00:09:57.900
Asymmetrics than there are symmetric algorithms. RSA

203
00:09:57.900 --> 00:10:00.600
 is widely used first publicly described in

204
00:10:00.600 --> 00:10:03.700
 1977 by Ron River study Schumer

205
00:10:03.700 --> 00:10:04.400
 and Leonard Adelman.

206
00:10:05.100 --> 00:10:08.900
Diffie helmets and other popular one with key exchange protocols and

207
00:10:08.900 --> 00:10:11.400
 there are many variations of diffie-hellman such as

208
00:10:11.400 --> 00:10:12.900
 mqv and El Gamal.

209
00:10:13.800 --> 00:10:16.400
And then there are elliptic curve cryptography Solutions, which

210
00:10:16.400 --> 00:10:18.300
 we're not going to deal much with in this lesson.

211
00:10:19.300 --> 00:10:22.000
But it might help you to understand how RSA works.

212
00:10:23.600 --> 00:10:26.700
High frequently find that when presenting cryptography to

213
00:10:26.700 --> 00:10:29.700
 novices people that are new to it. They're puzzled

214
00:10:29.700 --> 00:10:32.200
 by this idea. How can one key encrypt but it

215
00:10:32.200 --> 00:10:35.800
 can't decrypt and I often find it helps them to

216
00:10:35.800 --> 00:10:38.100
 see RSA how it works. You don't have to

217
00:10:38.100 --> 00:10:41.100
 memorize all the RSA functionality. But if

218
00:10:41.100 --> 00:10:42.900
 you see the general flow, it might help you.

219
00:10:44.200 --> 00:10:46.100
So let's start with generating a key.

220
00:10:47.500 --> 00:10:48.700
The very first thing you do.

221
00:10:49.600 --> 00:10:52.100
Is generate two large prime numbers?

222
00:10:53.500 --> 00:10:56.200
They need to be approximately equal size and they need

223
00:10:56.200 --> 00:10:59.300
 to be number such that their product is the required bit

224
00:10:59.300 --> 00:11:02.700
 length. So if you want a 4,096 bit RSA key.

225
00:11:03.400 --> 00:11:06.800
P and Q multiplied together to get in in needs

226
00:11:06.800 --> 00:11:08.500
 to be 4,096 bits long.

227
00:11:09.300 --> 00:11:11.800
So far nothing particularly difficult in the mathematics.

228
00:11:12.600 --> 00:11:15.100
You then will compute P times q and get in.

229
00:11:16.100 --> 00:11:17.300
So far easy math.

230
00:11:18.100 --> 00:11:21.300
The next one is you're going to compute P minus 1 times

231
00:11:21.300 --> 00:11:24.200
 Q minus 1 now that might puzzle you as to

232
00:11:24.200 --> 00:11:27.200
 why frankly there's a whole bunch of

233
00:11:27.200 --> 00:11:30.700
 mathematics behind that including relationships between numbers

234
00:11:30.700 --> 00:11:33.000
 that are called coprime numbers that have no

235
00:11:33.300 --> 00:11:36.200
 common factors a thing called Euler's totient and

236
00:11:36.200 --> 00:11:40.100
 things of that nature that really aren't important for our purposes. If

237
00:11:39.100 --> 00:11:42.700
 you do want more detail and cryptography the

238
00:11:42.700 --> 00:11:45.500
 ecouncil certified encryption specialist course

239
00:11:45.500 --> 00:11:48.300
 gets into all those details and the math

240
00:11:48.300 --> 00:11:51.500
 behind them, but for now, we just take P minus

241
00:11:51.500 --> 00:11:54.600
 1 times Q minus 1 to get M. That's mathematics

242
00:11:54.600 --> 00:11:55.000
 you could do.

243
00:11:56.400 --> 00:11:59.700
We choose some small number e that only has to have two properties.

244
00:11:59.700 --> 00:12:02.700
 It's smaller than M and its co-prime pm.

245
00:12:04.300 --> 00:12:07.600
And then we solve this little mathematical problem what number

246
00:12:07.600 --> 00:12:11.000
 D such that D times e modem that's

247
00:12:10.700 --> 00:12:13.300
 modulus operator is congruent to

248
00:12:13.300 --> 00:12:16.800
 one now again, if you're not familiar with modules operations and

249
00:12:16.800 --> 00:12:19.500
 congruences ignore them for now. It's

250
00:12:19.500 --> 00:12:22.400
 not necessary if you'd understand blockchain, and again,

251
00:12:22.400 --> 00:12:25.500
 I recommend the EC Council certified encryption specialist

252
00:12:25.500 --> 00:12:26.700
 to get more detail.

253
00:12:27.600 --> 00:12:30.200
Well now you'll publish en as the public

254
00:12:30.200 --> 00:12:32.500
 key and DNA your private key.

255
00:12:33.600 --> 00:12:37.100
And in fact something should become clear right now. You're

256
00:12:36.100 --> 00:12:39.400
 probably familiar with mathematicians liking to

257
00:12:39.400 --> 00:12:42.300
 use x's and y's, why did we use d and e

258
00:12:42.300 --> 00:12:45.900
 because e encrypts and D decrypts. Let's

259
00:12:45.900 --> 00:12:48.000
 see how that works. Once you've generated the keys.

260
00:12:48.900 --> 00:12:50.300
If you would like to send a message.

261
00:12:51.200 --> 00:12:54.500
You take that plain text raise it to the eighth power mod in.

262
00:12:55.400 --> 00:12:58.200
To decrypt it the recipient raise it

263
00:12:58.200 --> 00:13:00.900
 to the Deep power mod and we'll get back the plane text.

264
00:13:01.700 --> 00:13:04.200
Now real RSA and the real world users pretty

265
00:13:04.200 --> 00:13:04.700
 large numbers.

266
00:13:05.500 --> 00:13:08.500
Let's take a look at it with fairly small numbers just seemed

267
00:13:08.500 --> 00:13:09.200
 at the concepts down.

268
00:13:10.200 --> 00:13:13.600
Let's say we pick the numbers p and

269
00:13:13.600 --> 00:13:16.000
 Q for p equals 17 and Q equal 11.

270
00:13:17.600 --> 00:13:20.200
multiplying them together as fairly trivial you get 187

271
00:13:21.700 --> 00:13:24.400
P minus 1 or 17 minus 1 is 16

272
00:13:24.400 --> 00:13:27.200
 Q minus 1 11 minus 1 is 10

273
00:13:27.200 --> 00:13:30.000
 and 16 times 10 is 160.

274
00:13:31.300 --> 00:13:34.600
I'm going to select an evalue of seven. And if

275
00:13:34.600 --> 00:13:37.300
 I solve that little equation of what D times e

276
00:13:37.300 --> 00:13:39.200
 mod n is going to give me.

277
00:13:40.300 --> 00:13:42.700
One it turns out D is 23.

278
00:13:43.400 --> 00:13:46.400
So what that means is my public key is 7 e

279
00:13:46.400 --> 00:13:48.200
 and 187 in.

280
00:13:48.900 --> 00:13:51.700
My private key is d23 and

281
00:13:51.700 --> 00:13:52.800
 187 in.

282
00:13:53.500 --> 00:13:54.600
Well, let's see how that works.

283
00:13:56.200 --> 00:13:59.500
Let's say for some strange reason. I want to encrypt

284
00:13:59.500 --> 00:14:00.000
 the number three.

285
00:14:01.300 --> 00:14:04.500
So remember our key values there I take 3 to

286
00:14:04.500 --> 00:14:07.200
 the seventh power mod 187 and I'm

287
00:14:07.200 --> 00:14:08.100
 going to get 130.

288
00:14:08.700 --> 00:14:09.500
I send that to you.

289
00:14:10.300 --> 00:14:12.400
You take 130 to the 23rd power.

290
00:14:13.100 --> 00:14:16.300
Mod 187 you're going to get back three. So that's

291
00:14:16.300 --> 00:14:17.600
 how RSA works.

292
00:14:18.100 --> 00:14:21.600
And yes, the mathematics the actual implementation is quite

293
00:14:21.600 --> 00:14:24.100
 simple the why is a little more complicated.

294
00:14:25.600 --> 00:14:28.700
Hopefully this lesson gives you an overview of how

295
00:14:28.700 --> 00:14:31.300
 RSA functions. So you're more comfortable with

296
00:14:31.300 --> 00:14:34.500
 the concept of asymmetric cryptography and why the

297
00:14:34.500 --> 00:14:37.200
 two keys work interchangeably there has to

298
00:14:37.200 --> 00:14:40.100
 be some underlying mathematics that ties the two

299
00:14:40.100 --> 00:14:43.400
 keys together in this case e and D are tied

300
00:14:43.400 --> 00:14:46.900
 together because they are part of that equation D

301
00:14:46.900 --> 00:14:49.700
 times e volume is congruent

302
00:14:49.700 --> 00:14:50.000
 to one.

303
00:14:51.200 --> 00:14:54.200
And that's also why using e again the public

304
00:14:54.200 --> 00:14:57.300
 key again won't decrypt a message. It will

305
00:14:57.300 --> 00:14:58.300
 just further scramble it.

306
00:14:59.600 --> 00:15:02.400
Dimension elliptic curve we're not going to go in much

307
00:15:02.400 --> 00:15:04.400
 detail here. The mathematics is a bit tougher.

308
00:15:05.300 --> 00:15:08.700
But it's based. The security is based on the fact that finding

309
00:15:08.700 --> 00:15:09.800
 the discrete logarithm.

310
00:15:10.400 --> 00:15:13.500
Of a random elliptic curve element with respect to

311
00:15:13.500 --> 00:15:16.300
 a publicly known base point is difficult to

312
00:15:16.300 --> 00:15:17.700
 the point of being impractical.

313
00:15:18.600 --> 00:15:22.200
Basically elliptic curve is another option for public

314
00:15:21.200 --> 00:15:23.100
 key cryptography.

315
00:15:24.300 --> 00:15:27.200
Well now that you have a better understanding of public key cryptography.

316
00:15:27.900 --> 00:15:30.700
Let's talk about digital signatures when I'm

317
00:15:30.700 --> 00:15:34.600
 using cryptography. My concern is confidentiality. Bob

318
00:15:33.600 --> 00:15:36.400
 wants to send Alice a message or vice

319
00:15:36.400 --> 00:15:39.100
 versa and they don't want Eve to

320
00:15:39.100 --> 00:15:39.700
 be able to read it.

321
00:15:40.600 --> 00:15:43.700
Digital signatures are not concerned by themselves

322
00:15:43.700 --> 00:15:46.200
 with confidentiality. They want you

323
00:15:46.200 --> 00:15:49.300
 to know who did it. For example, if I'm

324
00:15:49.300 --> 00:15:52.500
 adding a transaction to a blockchain. I want to confirm it

325
00:15:52.500 --> 00:15:53.600
 was me that added it.

326
00:15:54.300 --> 00:15:55.200
So what I do there?

327
00:15:56.200 --> 00:15:58.200
Is I sign something with my private key?

328
00:15:59.400 --> 00:16:02.400
If you have my public key and pretty much everyone can

329
00:16:02.400 --> 00:16:06.100
 get it. It's public you can verify my

330
00:16:05.100 --> 00:16:08.700
 my message that I signed it because if

331
00:16:08.700 --> 00:16:11.100
 I didn't sign it if someone else did pretending to be

332
00:16:11.100 --> 00:16:14.200
 me, they don't have my private key when you try

333
00:16:14.200 --> 00:16:17.400
 to decrypt it or confirm it with my public key. You'll

334
00:16:17.400 --> 00:16:18.100
 get out gibberish.

335
00:16:19.100 --> 00:16:22.300
Now I'm not sending my private key. I'm encrypting a

336
00:16:22.300 --> 00:16:25.400
 message with my private key. And normally what's encrypted

337
00:16:25.400 --> 00:16:28.600
 is a hash of the message value. So to

338
00:16:28.600 --> 00:16:31.300
 confirm the signature you would decrypt with my public

339
00:16:31.300 --> 00:16:34.600
 key generate your own hash compare it and if

340
00:16:34.600 --> 00:16:37.200
 they didn't match it obviously wasn't me that signed it

341
00:16:37.200 --> 00:16:40.600
 a lot of email Solutions will do this for you if

342
00:16:40.600 --> 00:16:42.200
 you set it up and they'll do it automatically.

343
00:16:44.500 --> 00:16:46.000
So just to compare the two.

344
00:16:46.900 --> 00:16:49.700
In normal, asymmetric encryption. We're

345
00:16:49.700 --> 00:16:52.900
 trying to keep someone else from intercepting

346
00:16:52.900 --> 00:16:53.700
 and reading it.

347
00:16:54.400 --> 00:16:57.600
So I encrypt your message with the recipients public

348
00:16:57.600 --> 00:16:58.000
 key.

349
00:16:58.800 --> 00:17:01.400
The recipient that will decrypt it with their private

350
00:17:01.400 --> 00:17:04.800
 key that protects confidentiality with a

351
00:17:04.800 --> 00:17:07.400
 digital signature. I want you to know for a fact that I sent

352
00:17:07.400 --> 00:17:07.600
 it.

353
00:17:08.100 --> 00:17:11.400
So I use my private key to sign it anyone who receives

354
00:17:11.400 --> 00:17:13.800
 it can verify it with my public key.

355
00:17:15.100 --> 00:17:18.200
And this takes us naturally to what is a digital certificate.

356
00:17:19.200 --> 00:17:22.200
Well to begin with I keep saying anyone can have my

357
00:17:22.200 --> 00:17:22.900
 public key.

358
00:17:23.500 --> 00:17:26.400
How do they get it normally through distribution of

359
00:17:26.400 --> 00:17:29.500
 a digital certificate? It's a document that contains

360
00:17:29.500 --> 00:17:32.900
 your public key and some information to verify whose

361
00:17:32.900 --> 00:17:33.200
 key it is.

362
00:17:36.700 --> 00:17:40.100
The public key infrastructure is the infrastructure. Whereby

363
00:17:39.100 --> 00:17:42.700
 all these digital certificate vendors trust each

364
00:17:42.700 --> 00:17:45.400
 other and they trust each other because they're all using

365
00:17:45.400 --> 00:17:48.300
 public key cryptography standards that were

366
00:17:48.300 --> 00:17:50.800
 put in place by RSA the company not the algorithm.

367
00:17:51.700 --> 00:17:54.900
And a certificate is essentially a digital document that

368
00:17:54.900 --> 00:17:56.000
 identifies you.

369
00:17:56.600 --> 00:17:59.100
as confirmed by some trusted third party

370
00:18:00.100 --> 00:18:02.600
A certificate Authority. Is that trusted third party?

371
00:18:03.200 --> 00:18:06.500
Like thought verifying Go Daddy.

372
00:18:07.200 --> 00:18:11.700
A registration Authority is used to handle verification prior

373
00:18:10.700 --> 00:18:12.900
 to issuing the certificates.

374
00:18:13.600 --> 00:18:16.900
And a certificate policies a set of rules the determines

375
00:18:16.900 --> 00:18:18.400
 how a certificate may be used.

376
00:18:21.300 --> 00:18:24.500
Now x509 is the international standard used for

377
00:18:24.500 --> 00:18:27.300
 most digital certificates the most common found in

378
00:18:27.300 --> 00:18:27.500
 the world.

379
00:18:28.700 --> 00:18:30.800
most certificate authorities support

380
00:18:31.700 --> 00:18:32.700
x509

381
00:18:33.900 --> 00:18:36.400
You have certificate revocation list, which tell

382
00:18:36.400 --> 00:18:39.000
 you in a certificates no longer valid. They can be put out

383
00:18:39.400 --> 00:18:42.300
 by a push or pull models. And then there's the

384
00:18:42.300 --> 00:18:46.000
 restrict DNS recursive service which allows authorized

385
00:18:45.400 --> 00:18:48.700
 users to check

386
00:18:48.700 --> 00:18:52.000
 on validation of a specific certificate.

387
00:18:51.400 --> 00:18:54.600
 It's an alternative to certificate revocation

388
00:18:54.600 --> 00:18:55.000
 lists.

389
00:18:57.800 --> 00:19:01.400
Now this takes us to blockchain remember blockchain is

390
00:19:00.400 --> 00:19:03.900
 a decentralized system that

391
00:19:03.900 --> 00:19:07.400
 prevents control by a single entity transactions are

392
00:19:07.400 --> 00:19:10.400
 immutable. You can't change them and the blockchain network

393
00:19:10.400 --> 00:19:12.400
 lives in a state of consensus.

394
00:19:13.200 --> 00:19:16.500
There are no need for third-party intermediaries. Well, a

395
00:19:16.500 --> 00:19:19.200
 lot of the cryptography we just talked about is the basis for

396
00:19:19.200 --> 00:19:19.900
 how this functions.

397
00:19:21.400 --> 00:19:25.700
So for example, when a transaction is requested, someone

398
00:19:24.700 --> 00:19:27.100
 has to digitally sign it.

399
00:19:28.200 --> 00:19:31.900
And then as you probably already know each block is

400
00:19:31.900 --> 00:19:34.200
 connected to the last block the previous

401
00:19:34.200 --> 00:19:37.600
 block via cryptographic hash. So someone

402
00:19:37.600 --> 00:19:40.800
 requests that transaction there requested transactions

403
00:19:40.800 --> 00:19:42.600
 broadcast to the P2P Network.

404
00:19:43.500 --> 00:19:45.800
the network validates via consensus

405
00:19:46.800 --> 00:19:49.300
that verified transaction as we've

406
00:19:49.300 --> 00:19:52.100
 talked about before could be any number of things but the most

407
00:19:52.100 --> 00:19:55.900
 common is cryptocurrency exchanges could also be contracts or

408
00:19:55.900 --> 00:19:58.400
 insurance or what have you and in less than three. We'll talk

409
00:19:58.400 --> 00:19:59.700
 about some of those other options.

410
00:20:00.700 --> 00:20:03.300
When the transaction is verified a new block is

411
00:20:03.300 --> 00:20:06.400
 then added to the existing blockchain. So everything is

412
00:20:06.400 --> 00:20:08.200
 on alterable and permanent.

413
00:20:09.700 --> 00:20:12.700
There's no real physical form. There's no centralized Bank.

414
00:20:12.700 --> 00:20:16.000
 This is all done with peer-to-peer networks

415
00:20:15.200 --> 00:20:16.800
 and cryptography.

416
00:20:18.400 --> 00:20:20.800
Now we've used the word node in less than one in here.

417
00:20:21.700 --> 00:20:24.400
A node is a computer connected to a blockchain network

418
00:20:24.400 --> 00:20:27.700
 using a client that performs the validating task

419
00:20:27.700 --> 00:20:29.200
 on the relaying of transactions.

420
00:20:30.100 --> 00:20:33.800
It gets a copy of the blockchain which gets downloaded automatically as

421
00:20:33.800 --> 00:20:34.600
 soon as you join the network.

422
00:20:35.800 --> 00:20:38.800
Every note is an administrator and joins

423
00:20:38.800 --> 00:20:40.200
 the network voluntarily.

424
00:20:41.800 --> 00:20:43.100
Now a host node.

425
00:20:43.900 --> 00:20:45.600
Is one that's looking at.

426
00:20:46.600 --> 00:20:49.300
Trying to be a major part of the

427
00:20:49.300 --> 00:20:53.100
 network and it does this by proof of work proof

428
00:20:52.100 --> 00:20:55.700
 of work is usually what we call crypto mining.

429
00:20:56.500 --> 00:20:59.800
And it's done by solving computational mathematical issues and

430
00:20:59.800 --> 00:21:02.500
 then using that transactions to the blockchain.

431
00:21:03.800 --> 00:21:07.000
This allows a decentralized incentivized

432
00:21:06.700 --> 00:21:08.700
 methodology for adding blocks.

433
00:21:10.900 --> 00:21:14.300
In this lesson, we've talked about blockchain cryptography

434
00:21:13.300 --> 00:21:17.100
 hashes and digital signatures combined

435
00:21:16.100 --> 00:21:19.700
 with the information from lesson 1 this should

436
00:21:19.700 --> 00:21:21.700
 clarify for you how blockchain works.
