In this lesson,
we're going to discuss symmetric and asymmetric encryption.
Now, every encryption cipher is categorized
as either symmetric or asymmetric
based on the algorithm they use
and the type of key that's going to be used to secure the data.
Now, when you're using symmetric key encryption,
you're going to have a single key
that's used to encrypt and decrypt that data.
With asymmetric encryption though,
you're going to use two different keys,
one key to encrypt the data
and a second key to decrypt that data.
Now, symmetric key algorithms
are often called private key encryption
or private key algorithms,
because of the fact that both the sender
and the receiver need to know the same shared secret,
and this is that privately held key.
Now, in symmetric key encryption,
this is a fairly easy concept for us to understand,
because most of us use it on a daily basis.
I mean, after all, when you go home tonight
and unlock the front door to your house,
you're actually using symmetric key encryption to do it.
Basically, you're using the exact same key that your spouse
and your roommate or anybody else will have
to be able to unlock and open your door.
Now, if you wanted me to be able to get into your house,
you have to give me
an exact same copy of the key in your pocket.
That way, we both have the exact same private key
and we can both unlock
or lock your house as needed to get in and out.
This is our shared secret key.
Now, due to the fact that we have this shared secret key,
we can make sure that there is confidentiality
of all the items inside of your house,
because only the people who you give this key to
are going to be able to open the door and get inside.
But you can't be assured of non-repudiation,
because if somebody is able to go into your house
like your spouse or your roommate,
or even me because you gave me a key,
and one of us took your laptop,
because you weren't home,
you're not going to know who took that laptop.
All you know is that that laptop is gone.
Now, it could be any of us,
because we all have the same copy of that shared secret key.
Your spouse, your roommate, you, and even me.
We all have that key.
Now, a lot of us have a copy of that key,
which means that any of us
could have gone in and taken that laptop.
Now, beyond the challenge of proving who used the key,
there's also another big challenge
when we deal with symmetric algorithms,
and that is the distribution of that shared secret key.
So, if you wanted to encrypt an email
and send it to your five closest friends,
each of you would have to have a set
of shared secret keys set up for each one of those pairs.
That way, we'd have five different pairs of keys,
one for you and one for each of your five friends.
Now, if every one of those friends
also wanted to be able to share things with each other,
they're going to have to have another set
of keys for each of those five friends.
And in fact, this means we're going to have 15 sets
of different keys that are required,
so that everybody can communicate with everybody else.
This means that for every two people,
we each are going to have
to have our own set of individual keys.
Now, for the same reason
that peer-to-peer connections become untenable
at large scale, you're going to see the same thing happen here
when you're dealing with symmetric keys,
because as you get larger numbers and more users,
you need to share that secret among more people,
and this means you have a big distribution problem
on your hands to be able
to distribute all of these shared secret keys.
Now, most wireless networks used in small business
or home office networks
are going to utilize a shared secret key
in the form of a Wi-Fi password.
So, if I go over to your house this weekend for a big party
and you have 50 of your closest friends over
and you have to give them all that same shared secret key,
which is the password to get access to your network,
now, we have no confidentiality at all,
because so many people know that shared secret key.
And at this point, any one of the 50 people
could have been looking at the information on that network.
And that really is the big problem
when you start dealing with symmetric key encryption.
You have to figure out
how are you going to protect this shared secret
and how are you going to distribute it at scale
for all the people who need access to that data.
This brings us to our second category
that we use for encryption ciphers,
which is known as asymmetric algorithms.
Now, unlike symmetric algorithms,
asymmetric algorithms do not require a shared secret key.
And for this reason,
we often refer to this as public key cryptography.
Now, with asymmetric algorithms,
we are going to use two separate keys.
One key is going to be used to encrypt the data
and another key is going to be used to decrypt the data.
Now, the most commonly used forms
of asymmetric algorithms are going to be things
like the Diffie-Hellman algorithm, RSA,
an elliptic curve cryptography known as ECC.
Now, when we compare symmetric and asymmetric algorithms,
you may be wondering which one is better,
because it sounds like there's a lot of problems
with symmetric encryption, right?
Well, this really is a hard thing to discuss,
because there is no pure answer
where it's going to be great a hundred percent of the time
to use symmetric or asymmetric,
because both have been designed
for different purposes and they have different benefits.
For example, symmetric algorithms are very popular,
because they tend to be about 100 to 1,000 times faster
than an equivalently secure asymmetric algorithm.
But asymmetric algorithms do allow us
to overcome that key distribution challenge
that we face with symmetric algorithms.
Therefore, both of them have a place in our networks.
Now, as with most things in cybersecurity,
you're going to see that we can take the best of both worlds
by combining these into a hybrid approach.
Now, to overcome the key distribution problem for example,
most implementations are going to use asymmetric
or public key encryption
to be able to encrypt and share a shared secret key
or private key that can then be used
for symmetric encryption to secure the bulk
of the data transfer that's going to happen
between a sender and a receiver
now that they have the same shared secret.
And now, they're going to be able to pass information
back and forth much faster than they could
if they used asymmetric algorithms by themself.
This type of a hybrid approach
really does give you the best of both worlds.
Now, in addition to classifying algorithms
as either symmetric or asymmetric
based on their key and algorithm type,
we can also categorize an algorithm
as either a stream or a block cipher
based on the mathematical algorithm
that they're going to be using
to do their encryption and decryption processes.
Now, a stream cipher performs their computations
and encryptions a single byte at a time.
This makes it a bit by bit process,
and they utilize a key stream generator
to create a bitstream
that's going to be mixed with the input plain text
using a mathematically exclusive
or function known as an XOR function.
This will be used to create the encrypted cipher text
that is going to be there to store your data in.
Now, because these stream ciphers
can perform bit by bit encryption,
they're very well-suited
for securing real-time communication data streams
like streaming audio or streaming video.
Now, stream ciphers also tend to be symmetric algorithms
and they use the same key
for both encryption and decryption.
Now, the second type we have
is what's known as a block cipher.
A block cipher is going to be able
to break the input into fixed length blocks of data
before performing their encryption functions.
For example, if you had a message
that was one kilobyte in size,
we could break that up into 16 blocks of 64 bytes each.
Each of these 16 blocks
could then be processed by the cipher,
and then output out the other side of this algorithm
the block of cipher text that we are expecting.
If your message is less than 64 bytes,
then we'll use extra padding that's going to be added
to the data prior to it going through the encryption
to make sure it is a full 64 byte chunk.
Now, block ciphers in general
have several advantages over a stream cipher,
including being easier to set up and implement
and being less susceptible to security problems.
Block ciphers are also easily implemented
through software solutions, whereas most stream ciphers
tend to be used in hardware-based solutions.
So, remember, symmetric encryption
is a method of encryption where the same key
is used for both the encryption and decryption of data.
Asymmetric encryption on the other hand,
is a system of encryption
in which two different keys are used,
one for encryption and one for decryption.
There are also two different types
of ciphers that we can use.
These are stream ciphers and block ciphers.
A stream cipher is an encryption algorithm
that encrypts data bit by bit
or byte by byte in a continuous stream.
A block cipher, on the other hand,
is an encryption algorithm that encrypts data
in fixed size blocks that are typically sized
as 64, 128, or 256 bits in a block,
rather than doing one bit at a time.
We can then use these basic categorizations
of symmetric, asymmetric, stream, and block ciphers
to be able to help
group our different encryption technologies
into these different categories for easier reference,
as we're working out in the field
as cybersecurity professionals.