Asymmetric encryptions are incredibly powerful tools things like Orris a are just absolutely amazing
in terms of their power.
However asymmetric encryption generally requires a lot of overhead with RSA.
We have all kinds of other tools to provide authentication and we cover this in other episodes.
What it boils down to is that there's a lot of situations where you don't need a lot of authentication
or anything like that you just want to exchange a session key so you can kick a symmetric encryption
into gear.
And that's where something called Diffie Helman comes into play Diffie Helman is an asymmetric algorithm.
That's the first thing you need to understand.
But the only thing Diffie Hellman does is it doesn't really provide encryption per se it only provides
a methodology for two parties to come up with the same session key.
It's absolutely fascinating.
Diffie Helman is an incredibly powerful tool but you got to be careful.
It does use an asymmetric methodology but it doesn't have a classic public private pre-generated key
that you'd see with like RSA.
This is all kind of done on the fly using some fascinating integer mathematics in fact the mathematics
is so fascinating that it actually started to put me to sleep.
And unless you're really into discrete logarithms and modulo arithmetic you may not want to go through
all the details.
The beautiful part is is that when it comes to Diffie Hellman there's a wonderful analogy using your
Edhi color Alice and Bob want to send encrypted data to each other using some form of symmetric encryption.
So to do this they need the same key.
But the problem here is that we have Ebe a potential third party listening in and we don't want either
to be able to determine what our symmetric key is going to be.
So somehow we've got to come up with a magic way that both Bob and Alice can have the same symmetric
key without that key actually ever being moved across the wire so that IID could see it.
Now to do this we're going to use Diffie Hellman Diffie Helman is a key agreement protocol Sometimes
it's called a key exchange protocol and the whole goal of Diffie Helman is to take advantage of what
we called modular arithmetic.
So here's an example of modulo arithmetic.
This particular formula it's really really hard to figure out what three you'll see three to this question
mark power there.
Given this type of value it's very hard to figure out what we call the discrete logarithm of this particular
type of equation now.
So without going into any more detail than that well it makes it a lot more sense if instead of using
numbers like this let's pretend that we want both Alice and Bob to have a unique color.
So to do this we actually do use asymmetric encryption here in that first of all either Bob or Alice.
Define a particular public key.
Now this public key is a big long number.
But in this case let's just make it the color yellow because it's a little bit easier.
This is a unique color.
Now what we're going to do here is just as if we mix two different colors together to get a unique color
it is very easy to mix these two colors together.
But it's extremely difficult to get the exact to original colors out of that just by mixing them.
It's there's a million different potential colors.
So with that I did mind.
Let's go through a Diffee home in exchange.
OK.
So right now Allison Bob each have a public key and we're going to call this public key.
That will be the color yellow in this particular case.
Now Yves could see this public key too and you know what.
We don't care.
Now both Alice and Bob on their own.
Generate a random private value in this case.
We're going to say Alice is the color red and Bob is the color blue.
So what they're going to do is using this groovy mathematics.
In essence they're going to mix these colors together creating this third color.
Now Yves could see these colors but it's not going to do her any good because she doesn't know the private
color by which they derive that value.
So she she can't do anything with that so they go ahead and Alice and Bob exchange this mix.
And now here's the cool part.
Allison Bob then add their own private colors to this mix.
And it creates the exact same value.
So this funny looking kind of brownish color is actually a unique number and this is the number that
we can go ahead and do symmetric encryption with an e.
We'll never know what that number is Diffie Hellmann's been around for a long time.
And one of the challenges we run into with the Hellman is that because it uses big Energizers as the
initial seed to generate the key exchange some of these have shown themselves to be potentially crackable.
So what we do over the years is that the Diffie Helman people generate what we call the Hellmann groups.
So here's an example of some of these Diffie Hellman groups and you'll see that they have a numerical
value associated with them.
These numbers are simply used by the allicin Bobs who want to do DIFI home and to negotiate how big
of a number that they might want to use.
Now if you look at the bottom of this list you'll see it says elliptical curve.
Let me explain what that is.
Diffie Hellman because it uses large integers is subject potentially to cracking.
So just as we've seen with other types of asymmetric encryption the idea of using elliptic curve has
become very very popular.
So there are now ways to use elliptic curve Diffie Hellman in order to do the key exchange.
The nice part for us is we don't have to worry about that.
We just generate applications where that Alice and bobs that are doing to the Hellmann can negotiate
and they can ask for whatever group they want including elliptic curve
and.