I read a lot about this topic and all "detailed" explanations seem to miss a step:
For the client to verify the server, it does the following (according to my understanding):
- It obtains the certificate from the server. The certificate will contain public key and digital signature.
2?) Client verifies using the public key that the signature is OK.
Here is why I am confused. Say I am the man in the middle. I can connect to the server and obtain any information the server provides me, and then forward it to the client. How can the client tell who actually presented the certificate?
Here is what I also know in general:
Client knows public key. It encrypts a message with it and sends it to server.
Server knows private key, decrypts the message, and sends it back.
Now client can share symmetric key with server.
A man in the middle can be present, but it doesn't matter because data cannot be decrypted without private key.
So how does that relate to the (static?) digital signature in the certificate?
Please help me understand that specific step (verifying signature).