[MUSIC] Welcome back. In the last lesson we looked at the ideas that we need in order to be able to understand symmetric key encryption. Now I'm going to introduce you to both symmetric key encryption and asymmetric key encryption, which is what's used in order to then perform key negotiation. After this lesson, you will be able to compare and contrast these two cryptography basic concepts. So let's first start with symmetric key encryption. Now we just looked at the ideas that we need in order to be able to understand symmetric key encryption. And these ideas are highlighted here in our concept tree. Now we're going to move on to talking about symmetric key encryption. Now, we know that when you encrypt you have to have a private key, but the receiver needs to have a private key as well. In symmetric key encryption, both the sender and the receiver have to have the same key. Now you're probably wanting to ask how is it that they have the same key? For now, I would like to ask you to accept this as true, that they both have the same key, and we'll go over how they negotiate what private key that they're going to use in the next section. But at any rate, that's what symmetric key encryption is. You have the sender and the receiver both using the same private key to either encrypt a message or decrypt a message. An example of this symmetric key algorithm is AES, or also known as advanced encryption standard. Now, the way symmetric key encryption works is on the sender's side it has the plaintext message and a private key, and it feeds those two pieces of data into an encryption algorithm. And the resulting operation outputs is ciphertext message. And this ciphertext message is what gets sent over to the receiver. So when the receiver is ready to read the message, they take the ciphertext message and use this as input to a decryption algorithm. The receiver also gives it as input, the same private key that the center has used to encrypt this message. And when the receiver runs this decryption algorithm process, the output is a plaintext message that the sender intended to send the receiver. So now we just looked at symmetric key encryption. Now we'll move on to introducing asymmetric cryptography and mention public and private keys. Asymmetric cryptography is that concept that leads us to having the ability to agree on a shared secret key. And that shared secret key is then used to perform symmetric key encryption. Now, in asymmetric cryptography, what the sender needs is a public key of the receiver, which is used to encrypt their message of the receiver. The receiver needs the matching private key to that public key in order to decrypt the sender's message. Effectively, during asymmetric key encryption. The message is the agreed upon symmetric private key that the sender would like the receiver to use in future symmetric key encryption processes. An example of this key exchange protocol is Diffie-Hellman. So now let's move on to talking about public and private keys in a little bit more detail. Public and private keys are generated using a special algorithm, a key generation algorithm. And the relationship between the public and the private key is that there is only one private key to one public key, it's a one to one relationship. The public key is what the perceiver announces to the world basically. The private key is what the receiver keeps as secret, because this private key is used to decrypt messages intended for them. So now, how we go on and use this is the following. First, the receiver generates a public and matching private key, and using a special key generation algorithm, the receiver goes on and sends that public key into a public key repo. And this can happen once, you don't need to do this many times, just once. Unless you want to change your private key, but that's an aside. So let's say they publish their first public key into this repository and then along comes this sender who wants to send them a message. So what the sender does is they retrieve this receiver's public key from the public key repository. And they use that public key as the encryption key for their encryption algorithm. So they take the plain text message that they want to send, and they use that as input to the encryption algorithm. And they use the receiver's public key as the encryption key for this encryption operation. The resulting ciphertext is then sent over to the receiver. And when the receiver is ready to read the message they take the ciphertext that they had just received and put that as input to the decryption algorithm. And they use the private to decrypt the message, and outcome's the plain text message that the sender intended to send to the receiver.