Preface#
A simple summary of network protocols.
Division of Layers#
Physical Layer: Ethernet, Modems, Power Line Communication (PLC), SONET/SDH, G.709, Optical Fiber, Coaxial Cable, Twisted Pair, etc.
Data Link Layer: Wi-Fi (IEEE 802.11), WiMAX (IEEE 802.16), ATM, DTM, Token Ring, Ethernet, FDDI, Frame Relay, GPRS, EVDO, HSPA, HDLC, PPP, L2TP, PPTP, ISDN, STP, CSMA/CD, etc.
Network Layer Protocols: IP (IPv4, IPv6), ICMP, ICMPv6, IGMP, IS-IS, IPsec, ARP, RARP, RIP, etc.
Transport Layer Protocols: TCP, UDP, TLS, DCCP, SCTP, RSVP, OSPF, etc.
Application Layer Protocols: DHCP, DNS, FTP, Gopher, HTTP, IMAP4, IRC, NNTP, XMPP, POP3, SIP, SMTP, SNMP, SSH, TELNET, RPC, RTCP, RTP, RTSP, SDP, SOAP, GTP, STUN, NTP, SSDP, BGP, etc.
HTTPS Workflow#
- Symmetric encryption: Encrypts the data (request, response) for transmission using a symmetric key. The key is generated by the client and needs to be shared with the server.
- Asymmetric encryption: The server provides a public key (with a corresponding private key held by the server). The client uses the public key to encrypt the symmetric key, and the ciphertext is transmitted to the server.
- Man-in-the-middle attack: Hackers may intercept the public key provided by the server to the client and replace it with their own generated public key, leading to the leakage of the symmetric key.
- To address the man-in-the-middle attack, a certificate mechanism is introduced. A third-party certification authority issues a certificate to the website, which includes the public key. The client requests the certificate from the server and verifies it with the certification authority to check its legitimacy.
Conclusion#
The most frequently asked question in interviews about HTTPS is the 4-step process mentioned above. More accurately, this process is a flow of SSL/TLS, which is not only used in HTTPS but also in many other places.