Edexcel International Advanced Level Computer Science, point 12.1.2
Definition and function
A protocol is an agreed set of rules for communication. A protocol stack is a set of protocols arranged in layers, each handling part of the job. The Internet uses the TCP/IP stack, and SSL/TLS adds security.
a. TCP/IP
Definition
TCP/IP is the protocol stack that runs the Internet, named after two of its main protocols: TCP (Transmission Control Protocol) and IP (Internet Protocol). It has four layers.
The four layers
| Layer | Job | Protocols | Data unit | OSI layers |
|---|---|---|---|---|
| Application | User-level services | HTTP/HTTPS (web), FTP (files), SMTP/IMAP/POP3 (email), DNS | Data / message | 7, 6, 5 |
| Transport | End-to-end delivery between programs, using port numbers | TCP (reliable), UDP (fast, unreliable) | Segment (TCP) / datagram (UDP) | 4 |
| Internet (network) | Addressing and routing packets between networks | IP (IPv4, IPv6), ICMP | Packet | 3 |
| Link (network access) | Delivery on the local network and physical transmission | Ethernet, Wi-Fi | Frame / bits | 2, 1 |
TCP and UDP compared
| TCP | UDP | |
|---|---|---|
| Connection | Connection-oriented: set up first (three-way handshake) | Connectionless: just sends |
| Reliability | Reliable: acknowledgements, retransmits lost segments, puts segments in order | No guarantee: lost data isn't resent |
| Speed and overhead | Slower, more overhead | Faster, less overhead |
| Used for | Web pages, email, file transfer | Video calls, live streaming, online games, DNS |
TCP's three-way handshake: the client sends SYN, the server replies SYN-ACK, and the client sends ACK: the connection is established.
Encapsulation through TCP/IP
Each layer adds its header on the way down and removes it on the way up (decapsulation), as in the OSI model (12.1.1). You may be asked to complete a diagram of packets moving through the TCP/IP stack.
b. SSL/TLS
Definition and function
TLS (Transport Layer Security), and its older version SSL (Secure Sockets Layer), are protocols that provide a secure, encrypted connection over an insecure network. They sit between the application and transport layers, and are what makes HTTP into HTTPS (the padlock in the browser).
TLS provides three things:
- Confidentiality: data is encrypted, so eavesdroppers can't read it.
- Integrity: tampering is detected.
- Authentication: the client can check that the server is who it claims to be (using a digital certificate).
The TLS handshake
The handshake sets up a shared secret key using asymmetric encryption, then switches to fast symmetric encryption (3.2.2):
- ClientHello: the client lists the TLS versions and encryption methods (cipher suites) it supports, with a random number.
- ServerHello: the server chooses the best common options, sends its random number and its digital certificate, which contains its public key and is signed by a certificate authority (CA).
- Certificate check: the client verifies the certificate (is it signed by a trusted CA, valid, for this website, not expired?). If not, the browser warns the user.
- Key exchange: the client generates a secret (pre-master secret), encrypts it with the server's public key and sends it. (Modern TLS often uses a Diffie-Hellman exchange instead, for forward secrecy.)
- Server decrypts it with its private key. Only the server can, so both now share a secret.
- Both sides work out the same session key from the shared secret and the random numbers, and send "Finished" messages to confirm.
- Application data is encrypted with the symmetric session key: fast and secure.
Why this combination? Asymmetric encryption solves the key exchange problem but is slow. Symmetric encryption is fast but needs a shared key. The handshake uses the first to safely agree the second.
Certificates and trust
A digital certificate binds a public key to an identity (a website). A certificate authority vouches for it by signing it. Browsers come with a list of trusted CAs. This prevents an attacker from pretending to be the website (a man-in-the-middle attack).
Benefits and drawbacks of TLS
- Benefits: protects passwords, card details and personal data, detects tampering, proves the website's identity, and is widely supported.
- Drawbacks: extra processing and a slightly slower connection (the handshake), certificates must be bought, installed and renewed, protects data only in transit (not on the server), and older versions (SSL, early TLS) are insecure and must be disabled.
Worked example
Task: a user opens https://www.example.com. Describe how TCP/IP and TLS work together to load the page securely.
- DNS (12.1.4) finds the server's IP address.
- TCP sets up a connection with the three-way handshake (SYN, SYN-ACK, ACK), to port 443.
- TLS handshake: hellos, certificate, key exchange, session key agreed.
- The browser sends the HTTP request, encrypted with the session key.
- The data is encapsulated (segments, packets, frames) and routed across the Internet (12.1.3).
- The server decrypts it, sends the page back, also encrypted, and the browser decrypts and displays it.
Result: anyone intercepting the packets sees only encrypted data.
Exam tip: learn the four TCP/IP layers and a protocol for each, and TCP against UDP. For the TLS handshake, know the order: hello, certificate, check it, exchange the key using asymmetric encryption, then use symmetric encryption. Be able to complete a diagram of the handshake.
Check yourself
State the four layers of the TCP/IP stack
Application, Transport, Internet (network) and Link (network access).
Give one difference between TCP and UDP and one use of each
TCP is reliable and connection-oriented (web pages, email); UDP is faster but doesn't guarantee delivery (live video, games).
What does a digital certificate prove?
That a public key belongs to a particular website or organisation, as signed by a trusted certificate authority.
Why does TLS use both asymmetric and symmetric encryption?
Asymmetric encryption safely agrees a secret key but is slow; symmetric encryption is fast, so it is used for the data once the key is shared.
What three things does TLS provide?
Confidentiality (encryption), integrity (tamper detection) and authentication (verifying the server).