the next section that we're gonna move into is cryptography. And again, we're gonna do this at a high level. You don't have to have a doctor in cryptography or be an expert on modular math in order to do well in this section. But you do want to get some basic concepts, and we'll talk about what cryptography brings for us. Just you know, the service is. It provides
the very basic elements. What's a key? What's an algorithm?
Ah, we'll talk about symmetric versus asymmetric, and then how we use the two of those together in order to get kind of the best of both worlds. Ah, the security service is that cryptography provides his privacy, authenticity, integrity and non repudiation and how we're gonna be able to get those.
And then we'll look specifically digital signatures and how digital
certificates make all this meaningful. So if we start out with just the very basics of cryptography, just getting some terms down plain text plus an initialization vector plus an algorithm plus a key, all that comes together to give me cipher text.
So the first part of this plain text that's kind of the easy part, right? That's our unencrypted text. It's in the clear.
We don't want to transfer that across the network because, of course, anybody that intercepts that would be able to view the content.
So we want to take that plain text in, transform it into cipher text. Well, a couple of different elements are necessary.
One of the things that we often use as a starting point is something called an initialization vector. An initialization vector provides randomness to the process so that we get more randomness basically. So the idea is, if we vary the starting point from where we begin,
we're just going to get more and more and more randomness and random. This is good with cryptography.
We want the cipher text to be as far removed from the plain text as possible. So this is a random starting point. Quite honestly, we can't really call it a random starting point because computers really can't do random. It's got to be based on something. So it technically is a pseudo random starting point,
and all that means is the starting point is gonna be
based off of maybe CPU speed, internal temperature's variables, you know, numerous variables and even though it's gonna feel random and act random. It technically is based on something else, but it's the ad random ization
now the next piece, the algorithm.
The algorithm is a collection of math functions that can be performed. So if you think about it, everything in your system gets broken down into numbers. A series of ones and zeros and many algorithms will chunk those the streams of data or the amounts of data into what are called blocks.
So we take this long amount of data. We chunk it into 64 bite blocks, or
128 k, or are 128 bit or whatever that size. Maybe will chunk them into blocks, and each block goes through a series of math processes to provide the substitution so which math processes can be used? All of that's referred to as the algorithm,
which math processes in which order and how many is driven by the key. So if you want to think of the algorithm as the math function and the key is the instruction on which math functions to use in what order? How many? That's kind of how they go together so you can see we take the plain text, which is unencrypted.
Start with randomness through the initialization vector or pseudo randomness.
We use a collection of math functions as our algorithm and the key drives. Which math function we use is part of the algorithm. So the key and the algorithm really go together. And those air, the essential piece, not every instance, is going to use an initialization vector. But it is helpful
when we talk about cryptography. There really two main types, they're symmetric cryptography, and there's asymmetric cryptography.
Symmetric cryptography is usually pretty easy for people to understand because it's what we're used to.
Okay, symmetric means sane. So the key that I used to encrypt the message you need that same key in order to decrypt it. Same symmetric one key. And you and I have to share that key between us, right? I've gotta have the key to encrypt. You've gotta have that same key to decrypt.
My house uses symmetric cryptography. When I leave in the morning, I lock it with my house key. And when I come back in the afternoon, I unlock it with my house key again.
If I try to use the wrong key. I'm not getting in.
Okay, so So metrics. Usually pretty easy to understand that there are a couple problems with symmetric.
The first is because you and I have to share a key. How do I get you that key?
You know, can I leave it for you? Take to your monitor, or can I send it to you via email? Or, um, in a high security environment, Can I put it under your keyboard? What can we do to distribute that key? And the answer is,
Actually, I do know. But the answer was symmetric. Cryptography is there's not a good, easy way to distribute keys with symmetric cryptography. So that's a problem. We gotta figure out some way ahead of time to get the key distributed. Okay, Now, the second problem with symmetric key cryptography is that symmetric cryptography really isn't
as in it doesn't grow well in a large environment. And there's a little formula you can use to figure out how many symmetric keys you need. Given what number of users you don't need that for this exam. But the idea is you need a lot of keys for a lot of users because I need a key to communicate with every person. But
they also need keys to communicate with every other person. So you wind up having a lot of keys
in a purely symmetric environment, so it doesn't grow well.
Third problem is, you only get privacy with symmetric cryptography.
If I can get you a key distributed securely, we get a good guarantee of privacy and confidentiality.
just because the message is encrypted with the key that you and I share doesn't prove it came from me. You've got that key also,
and I can always say, No, it came from you. You've got the key.
So cryptographic Lee speaking. We don't get authenticity with a symmetric key because two parties share that keep.
We also don't get any sort of guarantee that the message hasn't been modified, and that's integrity. Just because I've encrypted a message with the key doesn't guarantee it hasn't been corrupted,
right? And the non repudiation non repudiation is actually a combination of authenticity and integrity. Authenticity guarantees wth e identity of the sender
integrity guarantees. The message hasn't been modified, So non repudiation essentially says that a cinder can't dispute having sent the message nor the contents of that message. So if you don't have authenticity and you don't have integrity, there's no way you're gonna get non repudiation.
So symmetric apostrophe is somewhat limited with what we can use it with,
but it is fast, fast, fast.
So when it comes down to actual data exchange, symmetric cryptography, something that we want to do, we want to use symmetric cryptography.
we need some way to solve all these other problems, and that's really where asymmetric cryptography comes in. An asymmetric cryptography solves many of these problems just in the very nature of how it works.
First of all, it deals with the scalability problem right off the bat,
because every user gets two keys, a key pair,
and they are a public and a private key.
So whether I have 10,000 users or two users, I will always have two keys as well every other person in my environment.
So right now we don't have to worry about containing the environments good for large environment. Um, the other thing that's important here is that we don't have to secretly distribute a key with asymmetric cryptography. I have a public key which I'll make readily available to anyone that want
I do not need to protect my public key. It is public.
Okay, now I also have a private key, which is mine and mine alone. It should never be disclosed. It should never be compromised. And if it is, the key pair needs to be revoked. And then I need to be re issued a new key pair.
Okay, So with this public private key,
the heart and soul of asymmetric cryptography is that anything encrypted with one can only be decrypted with the other.
So if you can encrypt something with my public key and think about that for a minute, let's say you've got a message. You want to get to me securely. You want it to be private.
You can ask me for my public key.
I'll give that to you because it's public.
If you encrypt a message for me with my public
on Lee, my private will be able to decrypt it.
And only I should have my private key.
So we didn't have to send anything sensitive across the wire. You asked my public key. I gave it to you. You encrypted the message with my public key came to me on the only one that can decrypt it because I'm the only one who has the private key. Okay, so the relationship between the key pair is essential to how asymmetric cryptography works.
Now, when I say you asked me for my public, he
you don't really ask me for my public heat. Your application asks my application. So, for instance, when you're
going to a website and having a secure transaction when you connect to, say, capital one or any of the other banking servers Wells Fargo, whoever might be out there, you connect using h T T P.
S right. That s on the end, says I want to secure transaction. So what's happening is your Web browser is asking that Web server for its public key.
anybody will give you their public key because it's not. There's nothing sensitive on it.
So when we do https, that's essentially saying, Hey, server, give me your public key.
And remember, I can use that servers public key to encrypt secret messages
because only that servers private key would be able to decrypt anybody intercepting the traffic or listening on the wire. Can't do anything with it.
Okay, so we get a lot of problems that are solved with asymmetric cryptography. We can also use asymmetric cryptography for authenticity as well.
Because if I decrypt, I'm sorry if I increase
a portion of my message Now, think this through because this could get a little tricky.
So I'm the sender. Kelly Hander hand. I'm sending you a message.
If I encrypt the message for you
with your public key, I get privacy. Right.
But what about if I encrypt just a tiny portion off that message with my private key?
Okay, if I take a portion of that message or let's say I put something on the message like a time stamp.
If I were to encrypt that with my private key,
you would decrypt it with my public key.
Okay, now that seems a little bit weird, right? Let's say I put a time stamp. It's 12 o'clock
and I encrypted with Kelly Hander Han's private key.
When you get that message specifically, your application gets that message. You're gonna try to decrypt the time stamp with Kelly Hander hands public.
If you can decrypt that time stamp
with Kelly Hander hands Public key.
It had to have been encrypted with Kelly Hander hands Private Key,
which only Kelly Hander hand has.
Okay, so when the sender uses their private key, they're guaranteeing their authenticity. Because when you decrypt whatever have encrypted with my public, you know it was encrypted with my private, So that's authenticity.
Okay, so asymmetric cryptography can provide more than just privacy.
That's a big benefit.
So pros and cons symmetric is fast, and that's enough to drive us to want to use symmetric cryptography. Okay, but we've got to figure out a way to exchange keys. We don't get authenticity, which means we're not going to get non repudiation. We don't get integrity with symmetric cryptography. It doesn't grow well, so we've got all these problems
now with asymmetric. It's slow,
fixes all the other problems, but it's slow.
So what we ultimately would like to do is find a way to use both of these and get a hybrid technology which really is gonna give us the best of both worlds, and that's where we're headed next