I'm no security expert, but I just know enough to get my job done. And here's what I have to share, a concise explanation of HTTPS. Topics includes SSL (secure socket layer), PKI (public key infrastructure), digital certificates, digital signatures, hashes, public/private keys, and stuff along those lines.
Let's start with this spreadsheet.
Now that all the terms are hopefully understood. Here's basically how HTTPS works. I'll call this protocol Mini-HTTPS because a lot of detail is skipped and is not exactly HTTPS. However, understanding Mini-HTTPS will definitely help you understand HTTPS if you want to.
- A user downloads Chrome. Chrome comes with a lot of digital certificates from CA's you trust. You trust them so much that you allow them to be shipped with Chrome. The digital certificates contain the CA's public key and is signed by the CA itself.
- You open Chrome and go to https://plus.google.com.
- Chrome detects that the URL starts with "https" so it needs some security checking.
- Chrome sends, "verify yourself" to the server.
- The server replies with, "here's my digital certificate, along with its hash encrypted by a well known CA (digitally signed)" It's like when you were a kid, if your Dad says you can trust somebody, you believe him.
- Chrome verifies the certificate.
- It tries to decrypt the digital signature (the hash encrypted by the CA) in the certificate. Chrome can do this because Chrome has the CA's public key from (1).
- If it can decrypt it, it means that the CA really signed this (because only the CA has the private key to sign this.)
- Since the CA really signed the certificate, it knows that the server can be trusted. Otherwise, the server wouldn't be able to get a signature from the CA.
- The resulting decrypted hash is untampered for sure because otherwise it wouldn't be able to decrypt it successfully.
- It computes the certificate's hash by itself and expects to get the same hash as the decrypted hash from (6.4). If they're different, it knows the certificate has been tampered with.
- It now trusts the the server is really https://plus.google.com because its certificate is "CA approved" and untampered with.
- Since Chrome trusts the server, it can confidently use the server's public key shipped with the certificate.
- Chrome creates a symmetric key to be used for the entire session. It doesn't use asymmetric keys because it's more expensive. A one time symmetric key would be secure enough because if the key was stolen, only this session will be affected.
- It encrypts the symmetric key with the server's public key and sends it to the server. (Only the server can see this symmetric key because only the server has the private key.)
- This symmetric key is used to encrypt normal HTTP traffic through out this session (session is defined as "everything until the client says it's done").
- When the client is done with this session, it sends "close session" to the server.
- No more HTTP encryption between the client and server beyond this point.
No comments:
Post a Comment