1
00:00:00.05 --> 00:00:01.09
- [Instructor] Now, in this
chapter, we're gonna talk about

2
00:00:01.09 --> 00:00:04.09
encryption, which is by
far the most common thing

3
00:00:04.09 --> 00:00:08.01
that people think of when
they think about crypto.

4
00:00:08.01 --> 00:00:09.05
But in order to level-set a little bit

5
00:00:09.05 --> 00:00:11.02
for the purposes of this course,

6
00:00:11.02 --> 00:00:13.04
I wanna talk a little bit
about encryption and decryption

7
00:00:13.04 --> 00:00:15.06
and make sure that we understand

8
00:00:15.06 --> 00:00:18.07
everything that goes
into this conversation.

9
00:00:18.07 --> 00:00:19.09
So the first thing we should talk about is

10
00:00:19.09 --> 00:00:22.03
what actually is encryption.

11
00:00:22.03 --> 00:00:25.07
And encryption is a process
by which we take plain data

12
00:00:25.07 --> 00:00:29.05
or plain text data and we make it hidden,

13
00:00:29.05 --> 00:00:31.09
often in plain sight.

14
00:00:31.09 --> 00:00:36.00
The hidden text or ciphered
data becomes difficult

15
00:00:36.00 --> 00:00:40.05
and actually, hopefully,
impossible to read without the key

16
00:00:40.05 --> 00:00:43.08
that was used to generate
that ciphered text.

17
00:00:43.08 --> 00:00:46.09
And essentially, we are saying
that only authorized parties,

18
00:00:46.09 --> 00:00:49.06
therefore, can read the
text in its original

19
00:00:49.06 --> 00:00:54.09
plain text format, assuming
that the cipher isn't cracked.

20
00:00:54.09 --> 00:00:59.02
Now, in reality, cryptography
and ciphering have been around

21
00:00:59.02 --> 00:01:00.09
for a very long time.

22
00:01:00.09 --> 00:01:04.04
In fact, it dates back
as far as ancient Egypt.

23
00:01:04.04 --> 00:01:07.09
One of the most common
use cases of ciphered text

24
00:01:07.09 --> 00:01:10.07
is actually the so-called Caesar's cipher,

25
00:01:10.07 --> 00:01:12.07
in which in the modern English alphabet,

26
00:01:12.07 --> 00:01:15.09
an A would become a D,
and a B would become E,

27
00:01:15.09 --> 00:01:20.02
and so on throughout in
order to hide the message.

28
00:01:20.02 --> 00:01:23.09
Now, we saw a big spike in
cryptography in the Middle Ages

29
00:01:23.09 --> 00:01:27.02
and Renaissance from both
European and even more so

30
00:01:27.02 --> 00:01:30.04
from Arabian mathematicians.

31
00:01:30.04 --> 00:01:34.07
Now, probably the most popular,
at least in modern culture,

32
00:01:34.07 --> 00:01:37.05
type of encryption actually
occurred during World War II

33
00:01:37.05 --> 00:01:40.06
in the so-called Enigma machine.

34
00:01:40.06 --> 00:01:43.03
This machine allowed the
Germans to communicate

35
00:01:43.03 --> 00:01:46.09
over radio waves, which
were easy to intercept.

36
00:01:46.09 --> 00:01:49.08
And in all honesty, had
the U.K. not cracked

37
00:01:49.08 --> 00:01:52.05
the Enigma machine, who
knows what the outcome

38
00:01:52.05 --> 00:01:54.08
of World War II would've been?

39
00:01:54.08 --> 00:01:57.09
Now, obviously, in modern times,
we are seeing a huge spike

40
00:01:57.09 --> 00:02:01.00
in both the algorithms
used to do encryption

41
00:02:01.00 --> 00:02:04.07
and also the attack vectors
against those algorithms.

42
00:02:04.07 --> 00:02:08.03
And it's a never-ending
game of who can be stronger

43
00:02:08.03 --> 00:02:11.04
at the current time.

44
00:02:11.04 --> 00:02:15.02
Now, in order to communicate
effectively about encryption,

45
00:02:15.02 --> 00:02:17.01
we need to talk about
the goals of encryption

46
00:02:17.01 --> 00:02:19.00
and really, there's four of them.

47
00:02:19.00 --> 00:02:20.05
The first is confidentiality

48
00:02:20.05 --> 00:02:22.09
and it's the one that
we think of most often.

49
00:02:22.09 --> 00:02:25.06
And it's also known as privacy.

50
00:02:25.06 --> 00:02:27.09
That says that the message that I send you

51
00:02:27.09 --> 00:02:31.06
is only readable by you,
assuming that the two of us

52
00:02:31.06 --> 00:02:37.01
share an algorithm and some
sort of key parlance between us.

53
00:02:37.01 --> 00:02:38.07
Now, the next is integrity.

54
00:02:38.07 --> 00:02:41.06
And that is saying that what you send me

55
00:02:41.06 --> 00:02:44.09
has not been modified by a bad actor.

56
00:02:44.09 --> 00:02:47.01
And we'll find out that
some stream ciphers

57
00:02:47.01 --> 00:02:50.02
actually are susceptible
to integrity attacks.

58
00:02:50.02 --> 00:02:52.04
More on that in a little bit.

59
00:02:52.04 --> 00:02:54.04
The third goal is authentication.

60
00:02:54.04 --> 00:02:55.09
And essentially, that is saying that

61
00:02:55.09 --> 00:03:02.00
you are who you say you are,
using cryptography to do so.

62
00:03:02.00 --> 00:03:05.03
And the final goal is non-repudiation.

63
00:03:05.03 --> 00:03:09.01
Now, this is a way of proving
that a message came from you

64
00:03:09.01 --> 00:03:12.01
and I believe that you actually sent it

65
00:03:12.01 --> 00:03:14.02
and I can prove that you sent it.

66
00:03:14.02 --> 00:03:18.02
And that's really the goal
of digital signatures.

67
00:03:18.02 --> 00:03:20.04
Now, we've talked briefly
about stream ciphers

68
00:03:20.04 --> 00:03:21.07
and really, there's two pieces.

69
00:03:21.07 --> 00:03:23.06
There's stream and block.

70
00:03:23.06 --> 00:03:26.08
Stream ciphers take an
individual bit at a time

71
00:03:26.08 --> 00:03:29.09
and either encrypt or decrypt it.

72
00:03:29.09 --> 00:03:32.05
Now, this can actually
lead to manipulation

73
00:03:32.05 --> 00:03:35.02
without cracking the algorithm itself,

74
00:03:35.02 --> 00:03:38.07
because the original format is maintained.

75
00:03:38.07 --> 00:03:41.05
So I can change bits and pieces of data

76
00:03:41.05 --> 00:03:45.04
without actually cracking it,
because I know the format.

77
00:03:45.04 --> 00:03:48.03
Block ciphers are much more used today.

78
00:03:48.03 --> 00:03:50.09
And block ciphers, as you might imagine,

79
00:03:50.09 --> 00:03:54.02
work on blocks of bits
instead of individuals,

80
00:03:54.02 --> 00:03:57.09
which no longer allows
that data to be manipulated

81
00:03:57.09 --> 00:04:01.00
without completing messing
up the entire block.

82
00:04:01.00 --> 00:04:03.05
So I can't change an individual value

83
00:04:03.05 --> 00:04:07.00
and still have the functions work.

84
00:04:07.00 --> 00:04:09.03
Now, when we're talking
about block ciphers,

85
00:04:09.03 --> 00:04:10.08
there's a few modes.

86
00:04:10.08 --> 00:04:13.06
The most common is cipher block chaining

87
00:04:13.06 --> 00:04:17.04
and it is a mechanism by which
the previous block cipher

88
00:04:17.04 --> 00:04:20.03
is combined with the
current block plain text

89
00:04:20.03 --> 00:04:23.00
in order to increase the entropy.

90
00:04:23.00 --> 00:04:25.05
Now, this requires an
initialization vector,

91
00:04:25.05 --> 00:04:29.01
because the first block does
not have a previous block

92
00:04:29.01 --> 00:04:31.04
in order to combine with it.

93
00:04:31.04 --> 00:04:34.09
Now, there's a couple other
modes that can be used,

94
00:04:34.09 --> 00:04:38.07
such as the cipher feedback
or output feedback mode,

95
00:04:38.07 --> 00:04:42.00
both of which were similar
to cipher block chaining,

96
00:04:42.00 --> 00:04:44.08
but they have a little
bit different output.

97
00:04:44.08 --> 00:04:47.04
The final mode is electronic code book,

98
00:04:47.04 --> 00:04:50.00
which does not have
manipulation of the block.

99
00:04:50.00 --> 00:04:54.06
And it is very uncommon in my experiences.

100
00:04:54.06 --> 00:04:56.04
I wanna talk a little bit about key size,

101
00:04:56.04 --> 00:04:59.00
because all too often, when
we talk about encryption,

102
00:04:59.00 --> 00:05:02.07
key size becomes the
major point of contention.

103
00:05:02.07 --> 00:05:06.09
Now, a key size increase
within an algorithm,

104
00:05:06.09 --> 00:05:09.07
by its very nature, increases the security

105
00:05:09.07 --> 00:05:11.05
of that algorithm.

106
00:05:11.05 --> 00:05:15.01
However, key size varies by algorithm

107
00:05:15.01 --> 00:05:19.01
and this is especially true
in asymmetric encryption.

108
00:05:19.01 --> 00:05:23.02
For instance, an RSA key size of 2048

109
00:05:23.02 --> 00:05:25.07
may actually be less secure

110
00:05:25.07 --> 00:05:30.06
than an elliptical curve
algorithm using only a 256-bit

111
00:05:30.06 --> 00:05:31.09
key size.

112
00:05:31.09 --> 00:05:35.01
So really, in the
asymmetric space especially,

113
00:05:35.01 --> 00:05:37.01
that key size really doesn't matter.

114
00:05:37.01 --> 00:05:38.07
It's the algorithm that matters.

115
00:05:38.07 --> 00:05:42.00
And then within that algorithm,
the key size matters.

116
00:05:42.00 --> 00:05:44.00
What is really critical though,

117
00:05:44.00 --> 00:05:46.08
is based on the current data we have,

118
00:05:46.08 --> 00:05:49.07
we should be using a sufficient key size

119
00:05:49.07 --> 00:05:53.03
in order to protect our ciphers.

120
00:05:53.03 --> 00:05:55.08
Now, I do wanna give one
more bit of information here

121
00:05:55.08 --> 00:05:58.09
and that's the concept
of codes versus cipher

122
00:05:58.09 --> 00:06:01.04
and there are a couple differences.

123
00:06:01.04 --> 00:06:05.09
Codes are really a way of
replacing or substituting data.

124
00:06:05.09 --> 00:06:08.06
I like to think of these
as a database type thing.

125
00:06:08.06 --> 00:06:11.03
We're really used to use codified values

126
00:06:11.03 --> 00:06:13.04
in order to remove the duplication of data

127
00:06:13.04 --> 00:06:15.01
across our database.

128
00:06:15.01 --> 00:06:18.09
And really, codes in this
realm are very much the same.

129
00:06:18.09 --> 00:06:21.09
We replace a bit of data
with another piece of data,

130
00:06:21.09 --> 00:06:24.05
but really, it's a one-to-one match.

131
00:06:24.05 --> 00:06:27.00
Ciphers are mathematical encryptions

132
00:06:27.00 --> 00:06:30.00
or mathematical
transformations of the data,

133
00:06:30.00 --> 00:06:33.02
such that often, it's no
longer a one-to-one match

134
00:06:33.02 --> 00:06:35.06
between the two, because of various things

135
00:06:35.06 --> 00:06:39.07
like initialization vectors
that can change the behavior.

136
00:06:39.07 --> 00:06:41.09
Now, we've got one more
concept to talk about

137
00:06:41.09 --> 00:06:44.08
and that is symmetric versus
asymmetric encryption.

138
00:06:44.08 --> 00:06:47.03
But we're gonna talk about
that in the next video.

