Hello and welcome to this fundamentals of cryptography class.
In this video, we're going to start our discussion of symmetric key cryptography.
We talked about earlier in this course, there's two main types of encryption algorithms, ones that
use the same key for encryption, decryption or symmetric algorithms and ones that use different keys
for encryption and decryption, which are called asymmetric or public key algorithms.
In this video, going to talk about the first of these.
So let's take a look at what we're going to be covering in this video.
We're going to start out talking about the fundamentals of symmetric cryptography.
Some of the bare basics of what a symmetric encryption algorithm is, how it works, and some different
types of symmetric encryption algorithms.
After that, we're going to talk about block ciphers.
And as we briefly touched on earlier, a block cipher encrypts data in chunks.
And in this video, we're going to talk about that and also the fact that in order to work a block cipher
probably needs to use a block cipher mode of operation.
So we'll talk briefly about what those are, how they work and some of the security considerations associated
with them.
Finally, we're going to close out this video talking about stream Cyprus, the other type of symmetric
encryption algorithm.
And in that discussion, we're going to cover bit flipping attacks.
So one of the main security risks associated with.
Stream cyphers.
And so let's get started with some metric cryptography and so symmetric encryption algorithms are designed
to use the exact same key for encryption and decryption.
This makes key management fairly simple because anyone who has the secret key can decrypt the message.
However, this also has the issue that anyone with the secret key can decrypt the message.
And this is a problem because it means that for symmetric encryption algorithm to work, you need to
share this secret key with all of the authorized recipients without anyone unauthorized, i.e. an eavesdropper
getting access to it, which means that you need a secure channel between the two or more parties that
are going to be using this encryption algorithm and establishing that secure channel could be a problem.
And with symmetric algorithms, we have two main types.
We're gonna be looking at block ciphers and stream ciphers for the rest of this video.
And so let's get started out talking about block snipers.
We've talked about in previous videos that block cyphers encrypt and decrypt data in fixed sized blocks.
We're going to talk about a yes and a later video.
And you may know that A-s has a few different key lengths, but it uses a standard block size of one
hundred and twenty bits.
And so if a plain text length is not an exact multiple of the block length, the algorithm is going
to use padding.
And the exact nature of this padding doesn't matter in general.
You can use all zeros or ones, some sort of secret message, whatever.
However, in some cases it really does matter.
There are certain cases where T plus the implementation, the block padding scheme actually allowed
decryption of a message.
And so in general, padding is fine, but it's best to use just boring padding rather than something
useful.
And that cup padding covers the case where a plain text length is not exactly a multiple of a block.
However, it doesn't cover the case of if a plain text length is longer than a single block.
You need to fit all of your messages into one hundred and twenty eight.
Bits are fewer than you might have a problem using symmetric keying corruption or A.
S in particular for most of the applications that we use it for today.
And so instead of limiting us to one hundred and twenty eight messages, symmetric key encryption often
uses blocks, cipher modes of operation.
And so a block safer mode of operation.
All it is, is an algorithm that defines how to encrypt a message containing multiple blocks.
However, not every mode of operation is created equal.
For example, on the simplest block site mode of operation is electronic code book or ECB mode.
And in this mode, every block is encrypted separately.
You just break the plain text.
The chunks run each one through the same encryption algorithm with the same secret key and collect the
resulting ciphertext and put them together to make the final message.
And so the image on the right hand side of this slide shows an example of the Lennix penguin encrypted
using ECB mode.
And as you can tell, you can still see the penguin.
And the reason why is that ECB mode means that the same plain text produces the same ciphertext for
a block.
And so with, say, the Linux Penguin, if your book, each block is a single pixel of the image, a
black pixel always has the same value.
No matter where it is in the image.
And so you get what we see here where the Linux Penguin is clearly visible because pixels of the same
color produce the same ciphertext.
So it might not be possible to reverse engineer at the exact color scheme of the penguin, but we can
still see the penguin.
There are other modes of operation.
Different ones have different advantages and disadvantages.
Some of them, if used in certain contexts, may not be secure for different reasons than our ECB mode
with the Lennix penguin and some provide additional benefits.
For example, Galois Counter Mode, or GCM mode of operation uses a hash function built into the algorithm
to use a message authentication code, which is useful because that Mac code.
We'll talk more about with hash algorithms later in this course verifies the integrity of the method.
So not only do confidentiality from our CIA try it, you also get integrity all in one bundle.
And so a number of different blocks, cipher modes of operation recommends you look into them a bit
if you're planning on using cryptography and never use ECB mode and make sure that the mode that you're
using is secure for your application.
And so now let's switch gears from block cyphers to stream cyphers, so unlike Bloks cyphers, stream
cyphers encrypt data one bit at a time.
And so we talked previously in this course about the one time pad algorithm and how it exclusive ore's
each bit of the plain text with each bit of the key to produce the ciphertext.
And while this is information theoretically secure, it's not really usable.
Stream ciphers are designed to make the one time pad usable, but less secure.
Instead of using a secret key the same length as the plain text, we use a much smaller one and then
use a key generation algorithm to take that secret key and create a bite stream or bitstream that we
then exclusive or with the plain text, just like the one time pad.
And so one of the advantages of a stream cipher is that ensures that the cipher text is no longer than
the plain text using a block cipher.
You're going to get a little extra space, a little bit extra data in the cipher text because of that
padding, unless you just happen to have something that's a perfect multiple of the block.
And so stream ciphers are more efficient.
But they are vulnerable to a bit flipping attack and a bit flipping attack is one that takes advantage
of the fact that when you're using a stream site for your exclusive or a single bit of plain text with
a single bit of key to produce the ciphertext, and you perform pretty much the same process when going
from ciphertext to plain text as a result.
If an attacker has access to the cipher text, which is perfectly legitimate with the eavesdropping
situation, ciphertext isn't considered sensitive.
That's what you send over the Internet.
Then if they change a single bit of the sacred text.
All it does is change a single bit of the plain text, which may be difficult to detect depending on
the message being sent.
If you're sending a phrase in English or Spanish or some language, you may notice, oh, this doesn't
make sense because that bit flip changed a A to Z or something.
And say a word doesn't make sense.
However, if that bit flip is in the middle of a number on a bank transfer, then maybe it wouldn't
be detectable but has a significant impact.
And this is important because many of the blocks, cipher modes of operation don't have the same impact,
where a single bit flip in the ciphertext only affects a single bit of plain text.
And most of them in error will probably cascade through the decryption, which makes it more obvious
to detect.
And if you're using something like Galois counter mode with those message authentication codes, the
resulting a Mac code produced won't match.
And so the tampering will be evident after decryption has been performed.
And so this video is designed to provide a very high level introduction to symmetric key cryptography,
main takeaways here are that symmetric key cryptography uses symmetric keys, i.e. the same key for
encryption and decryption, that there are two different types, block ciphers and stream ciphers.
And both of them have their advantages and disadvantages.
A block cipher, maybe a little bit less efficient, requires a mode of operation which, depending
on your choice, could be secure or insecure, but is not vulnerable to a bit flipping attack in most
cases, like a stream cipher would be in the next video.
We're going to go a little bit more in depth and talk about some of the most famous examples of block
ciphers and stream ciphers in use today.