 So now you should have the basic of the cryptography. The basic of this cryptography should allow you to understand, for example, what is the TLS management, how the TLS handshake works. So I propose we go to this example and just see if now we are able to understand what's happened. First what is TLS? TLS is a transport layer security. It's a cryptographic protocol and it's a low authentication and encryption of data between server, device and web application. For example, when you connect on the site of ST and you can see the HTTPS for security, you've got encryption communication with a server. It's TLS that is behind this. There is a lot of different, I would say, normalization of TLS of capabilities. This is not a reference management of TLS. I just take one as an example or I will say a pretext just to check if we've got those by the cryptography. The part we will study together is the TLS handshakes. What happened before the communication become encrypted? And we will see that there is some mutual authentication. It's optional in this protocol, but here we will do it. So we will use some CS certificate, some device certificate, some private key to generate challenge signatures and things like that. Now I think you are familiar with those terms. Then we will see how we have the third session secret negotiation. And here we will rely on Diffie Hermann. There is other possibility with pre-shared secret, but here we will use Diffie Hermann. So let's go. This is a TLS handshake B1.2 RFC 5246. Many, many steps seem quite complicated. But what we will do now, we will check all these steps and try to understand them regarding what we've learned before with the basic of cryptography. And the purpose is to show you that now you are able to understand what's happened during this handshake. For sure, this is not a reference manual about TLS. So I would say sometimes it's a little bit simplified, but all those steps are real. So let's start with just focus on what we've got inside the remote server on the IoT device, the two devices we want to communicate. So we have an IoT device and a remote server who want to communicate in a secure way. No more Bob analysts. Let's check first with what we've got inside those at the beginning or before starting communication. So we've got a CR certificate, which allows to check some other certificates. We've got a server certificate in the remote server on an IoT certificate in the IoT device, so it's a public key. Each one got the associated private key. So that is for the beginning. In a real case, the CR certificate embedded in the server and in the IoT are not the same. But it just to simplify, I keep the theme. So how does it start? First, it was the IoT device who will provide the TLS version supported some algorithm on a random number. That should remind you something. It's a challenge for sure. So it's a clienteload sent to the server. On the server side, it will store this client random for the moment. And you will reply with a choice algorithm and also a random. So this is a server random. It was a server. Hello, come on. On the device, it will just store this server random for the moment. Next step. Now the server will sign the random value received thanks its private key. Remember, signatures is always done with a private key. Then it will provide a certificate. So I will say the public key of the server and the signed random. Now the IoT device will start to work again. First, it will verify the server certificate thanks to the CR certificate. So to check a signature, we use a public key. And the CR certificate is embedded a public key. Signature is correct. That means the server certificate is good. That means the public key of the server is valid. So we can use it now. And we will use it to check the signature of the client random. Check of the signatures. Server is now authenticated. Now the IoT know that the server is a real one. So it's what I sum up here. So next step. Now the server send a request to have the certificate of the device, but it will be answered later. And he will generate an ephemeral elliptic curves key pairs. So you remember elliptic curves. You choose a private part of the key. Then you put this algorithm that move a point on the curves. And finally you find a final point. And the public part of the key is this final point plus the generators plus the curves that have been used. So you choose a private part of the key. So it was a server ephemeral key. You use the algorithm of SSH key gen. So we move on the curves. And we've got this server ephemeral public key. Then this key, this public key will be signed. So signatures with the private part of the key. We use the private part to sign the server ephemeral public key. And we've got the signatures. So now the server sends this to the IoT device. So what the device will do now? First, he will check the signatures of the elliptic curve server key. So for that, what you need to check signatures is the public part of the key. We already received it before in the server certificate and we already checked that it was correct. So this time we will just use it. Signature is OK. So the ephemeral elliptic curves public key is valid. We store it and we will use it later. So now on the server side. We've got an ephemeral server private key. An elliptic curve one. On the IoT side, we've got the server certificate and we already checked it saying the CR certificate. We've got a server ephemeral public key and we've got the server random. So now it's time maybe to answer the challenge of the server. So we'll compute the signatures of the server random thanks to private key. And we will send the IoT certificate. That means the public key of the IoT device. The server random on its signatures. So on the server side now, we will first check the IoT certificate thanks to the CR certificate again. That's good. That means we now can use the device public key. We are sure about this. That is a real one. So now again, we check the signatures. But thanks to the IoT certificate this time, the device is authenticated. Server is sure that it's discussed with a real device. I will say that now we've got the mutual authentication that have been done.