AS & A Level Computer Science · Area 2 · A Level content

Encryption, encryption protocols and digital certificates

Encryption is examined as a set of decisions about keys: which key encrypts, whose key it is, and what that achieves. Students lose marks by mixing up the two directions - encrypting with a private key to keep something secret, or claiming a certificate encrypts data. Learn the two jobs separately, confidentiality and authenticity, then add SSL/TLS and certificate authorities on top of them, and every question in this section becomes the same question about which key is used and why.

Not started

Syllabus coverage

  • Show understanding of how encryption works
  • Use of public key, private key, plaintext, ciphertext, encryption, symmetric key cryptography and asymmetric key cryptography
  • How the keys can be used to send a private message from the public to an individual or organisation
  • How the keys can be used to send a verified message to the public
  • How data is encrypted and decrypted using symmetric and asymmetric cryptography
  • Show awareness of Secure Socket Layer (SSL) and Transport Layer Security (TLS)
  • The purpose of SSL/TLS and its use in client-server communication
  • Situations where the use of SSL/TLS would be appropriate
  • The purpose, benefits and drawbacks of quantum cryptography
  • Show understanding of digital certification and how a digital certificate is acquired
  • How a digital certificate is used to produce digital signatures

Part of the AS & A Level Computer Science syllabus 9618.

How encryption works: plaintext, ciphertext, keys and ciphers

Encryption is the process of turning readable data into a form that is meaningless to anyone who does not hold the key. The readable original is plaintext - an email, a password, a card number, a frame of video. The scrambled output is ciphertext, and decryption is the reverse process that turns ciphertext back into plaintext. The point of the whole exercise is that plaintext sent across a network passes through routers, servers and Wi-Fi access points that neither the sender nor the receiver controls, so anyone sitting on that path can copy it.

A cipher is the mathematical procedure that does the scrambling, and a key is the piece of data that the procedure is fed. Good modern design assumes the algorithm is public: AES and RSA are published, documented and analysed by thousands of people, and anyone can read exactly how they work. The security lies entirely in keeping the key secret. If security depended on the algorithm being secret, one leak would compromise every message ever sent with it, and every user in the world would have to change system at once.

A substitution cipher shows the idea, and shows why simple versions fail. Replace every letter with the letter three places further on and 'meet' becomes 'phhw'. The letters have changed, but the pattern of the language has not: e is still the most common letter in the ciphertext, double letters still appear together, and common short words still appear as short words. That leftover structure is what frequency analysis exploits. A modern block cipher such as AES takes 128 bits at a time and shuffles and substitutes them over many rounds, so that changing one bit of plaintext changes roughly half the bits of the ciphertext and no statistical trace of the original survives.

That leaves an attacker exactly two routes. The first is to attack the mathematics - try every possible key, or find a weakness in the algorithm - which is infeasible for a long key. The second is to obtain the key itself by stealing it, guessing it, phishing it or intercepting it while it is being distributed. The second route is almost always easier, which is why the rest of this topic is about keys rather than about ciphers.

TermMeaning
PlaintextThe original readable data, before encryption
CiphertextThe scrambled output of encryption; meaningless without the key
EncryptionThe process of converting plaintext into ciphertext using an algorithm and a key
DecryptionThe process of converting ciphertext back into plaintext using the algorithm and the correct key
KeyThe value that controls the encryption; the secret that must be protected
CipherThe published algorithm (for example AES or RSA) that performs the scrambling
Never write that a message is 'encrypted with a password' and stop there. Say what the key is, who holds it, and what an attacker would have to do to read the message without it.

Symmetric key cryptography: one shared key

In symmetric key cryptography the same single key is used both to encrypt and to decrypt, so both the sender and the receiver must already hold an identical copy. The key is sometimes called a shared secret or a secret key. It is fast: a modern processor encrypts hundreds of megabytes a second with AES, which is why symmetric ciphers are used for the bulk of the data in every secure connection you make.

Its weakness is not speed but key distribution. If Alice and Bob have never met, how does the key reach Bob without an eavesdropper copying it? Sending the key over the same network that the message will travel on simply moves the problem: whoever can intercept the message can intercept the key. The problem gets worse as the number of users grows, because each pair of users needs its own key: with 100 users that is 4 950 keys to generate, distribute, store and revoke, and with 1 000 users it is 499 500. There is no formula that makes this manageable.

A second weakness is that symmetric cryptography alone gives no proof of origin. Because both sides hold the same key, a message that Bob receives could have been created by Bob himself, so he cannot prove to a third party that Alice sent it. This property is called non-repudiation, and symmetric cryptography cannot provide it.

Key length is the practical defence against brute force. Each extra bit doubles the number of possible keys, so a 128-bit key is not twice as hard to break as a 64-bit one but about 2^64 times harder. DES used a 56-bit key and is now breakable by dedicated hardware in hours, which is why it was replaced by AES, which uses 128, 192 or 256-bit keys.

  • One key, two directions: the same key encrypts and decrypts, so both parties must already hold it.
  • Fast: ideal for bulk data such as files, video and the body of a web page.
  • Key distribution problem: the key has to reach the other party securely before anything can be sent.
  • Scaling problem: n users need n(n-1)/2 keys, so 1 000 users need 499 500 keys.
  • No non-repudiation: either party could have produced the ciphertext, because both hold the same key.
  • Examples: AES (128/192/256-bit keys) is current; DES (56-bit) is obsolete.
The exam phrase is 'the same key is used to encrypt and decrypt'. If a candidate writes that the key is private, be precise about what that means - it is shared between exactly the two parties, not published.

Asymmetric key cryptography: a linked pair of keys

Asymmetric key cryptography uses two different but mathematically related keys, generated together as a key pair. The public key is published - placed in a directory, on a website, inside a digital certificate - and anyone may have a copy. The private key never leaves the owner's machine and is never transmitted. What one key of the pair encrypts, only the other key can decrypt, and it is computationally infeasible to work out the private key from the public one.

The relationship is a one-way function: easy to compute in one direction, effectively impossible in the other. In RSA, the public key is built from the product of two very large prime numbers, and recovering the private key means factoring that product back into the two primes - trivial for small numbers, hopeless for the 2 048-bit keys used in practice. The pair can be generated locally on the owner's own machine, so the private key never has to cross a network, which removes the distribution problem that symmetric cryptography suffers from.

The price is speed. Asymmetric operations involve arithmetic on very large numbers and are hundreds to thousands of times slower than AES, so asymmetric cryptography is never used to encrypt a video or a whole web page. It is used for short pieces of data only: encrypting a symmetric session key, and creating and checking digital signatures.

The direction of use decides what you get, and this is the single most examined idea in the topic. Encrypting with the recipient's public key gives confidentiality, because only the holder of the matching private key can decrypt. Encrypting with the sender's private key gives authenticity and integrity, because anyone can reverse it with the published public key, so the only way to produce it was to hold the private key.

AimEncrypt withDecrypt or verify withWho can read itProperty provided
Send a private message to an individual or organisationThe recipient's public keyThe recipient's private keyOnly the recipientConfidentiality
Send a verified message to the publicThe sender's private keyThe sender's public keyAnyone - but only the sender could have created itAuthenticity, integrity and non-repudiation
Fix the two sentences in your memory and the rest follows. To keep it secret, use the other person's public key. To prove who sent it, use your own private key.

Sending a private message from the public to an individual or organisation

This is the case the syllabus describes as a private message from the public: a customer, a stranger, someone who has never spoken to the organisation before, wants to send it something that nobody else may read. A bank publishes its public key. The customer fetches it, encrypts the message with it, and sends the ciphertext. The ciphertext can only be decrypted with the bank's private key, which never left the bank's servers. The customer cannot read back what they have just sent either, which is a useful test that the encryption was done the right way round.

The elegance of this is that no prior shared secret is needed. The public key can be published to the entire world, printed on a poster, embedded in a certificate; publishing it does not weaken the encryption in the slightest, because it can only be used to lock data, not to unlock it. This is how asymmetric cryptography solves the key distribution problem: a million customers can each use the same public key, and only the organisation can open what they send.

The weakness is the reverse of the one it solves. Nothing in the mathematics tells the customer that the key they downloaded really belongs to the bank. An attacker who can intercept the traffic could publish their own public key, claim to be the bank, decrypt everything the customer sends with their own private key, re-encrypt it with the real bank's public key and pass it on. That is a man-in-the-middle attack, and the answer to it is the digital certificate covered later in this topic.

  • 1. The organisation generates a key pair and publishes the public key.
  • 2. The member of the public obtains that public key (in practice from the organisation's digital certificate).
  • 3. The sender encrypts the plaintext with the organisation's public key to produce ciphertext.
  • 4. The ciphertext is sent across the network; anyone may copy it, but it is meaningless to them.
  • 5. The organisation decrypts with its private key, which no one else holds.
  • 6. The message is confidential: no other party, including the sender, can recover the plaintext from the ciphertext.
One-way, and the examiner can tell instantly: if the message is encrypted with the organisation's private key then anyone holding the public key can read it, so there is no confidentiality at all - and the organisation has given away the one thing it must protect.

Sending a verified message to the public: digital signatures

Now reverse the problem. A software company publishes a security update and wants every customer to be able to check that it genuinely came from the company and was not altered on the way. Confidentiality is not the issue - the update is public - so encrypting it with the customers' public keys would be pointless. What is needed is proof of origin and proof of integrity.

The sender first computes a hash of the message: a fixed-length digest, produced by a one-way function, such that the same message always gives the same digest and any change to the message - even a single bit - produces a completely different one. The sender then encrypts that hash with their own private key. The result is a digital signature, which is sent alongside the message. This is exactly how a digital certificate is used to produce digital signatures: the certificate proves which public key belongs to the sender, so the receiver knows whose key to verify against.

The receiver decrypts the signature using the sender's public key, which recovers the original hash. The receiver then hashes the message they actually received and compares the two digests. If they match, the message is unchanged; and because only the sender holds the private key that produced the signature, the message must have come from the sender. If a single character was altered in transit, the recomputed hash will not match and the software refuses to install.

A digital signature therefore gives three things at once: authenticity (it came from the holder of that private key), integrity (it has not been altered) and non-repudiation (the sender cannot credibly deny having signed it, because no one else could have produced that signature). It gives no confidentiality, because anyone with the public key can read the message. Real systems that need both sign and encrypt: sign with the sender's private key, then encrypt the message and the signature with the recipient's public key.

StepSenderReceiver
1Computes a hash (digest) of the messageReceives the message and the digital signature
2Encrypts the hash with their own private key - this is the signatureDecrypts the signature with the sender's public key to recover the hash
3Sends the message and the signature togetherComputes a fresh hash of the message as received
4-Compares the two hashes: identical means the message is genuine and unaltered
A signature proves who and unchanged; encryption provides who cannot read it. If a question asks for both, you must use both directions of the key pair, and say which comes first.

How data is encrypted and decrypted with symmetric and asymmetric cryptography together

Real systems do not choose between the two types; they use each one for what it is good at. Asymmetric cryptography solves the key distribution problem but is far too slow for bulk data. Symmetric cryptography is fast but needs a shared key. The hybrid approach uses asymmetric cryptography once, at the start, to establish a symmetric key, and then uses that symmetric key for everything else.

The sequence is the one you must be able to write out. The client contacts the server and the server replies with its digital certificate, which contains its public key. The client checks the certificate against the certificate authorities it already trusts. The client then generates a random session key, encrypts it with the server's public key, and sends it. Only the server can decrypt that with its private key, so both ends now hold the same session key and nobody listening does - the key distribution problem is solved without the key ever being readable in transit. From that point the session uses a fast symmetric cipher such as AES, with a new session key for each connection.

TLS can also agree the key rather than transmit it, using Diffie-Hellman key exchange (in modern TLS, the ephemeral form). Each side contributes to a shared value that neither can predict alone, and the key is never sent at all, even in encrypted form. Ephemeral keys also give forward secrecy: because a fresh key is derived for every session and then discarded, stealing the server's long-term private key tomorrow does not allow an attacker to decrypt the traffic they recorded today.

The practical lesson is that both types appear in one connection, doing different jobs: asymmetric cryptography for identity and key exchange, symmetric cryptography for the data itself. A candidate who says 'TLS uses asymmetric encryption' without qualification has described only the beginning of the connection.

  • Asymmetric job: prove the server's identity and get a key safely to the other side.
  • Symmetric job: encrypt the actual data, fast, for the rest of the session.
  • The symmetric key is called a session key; a new one is generated for each connection.
  • The session key may be sent encrypted with the server's public key, or agreed using Diffie-Hellman and never transmitted.
  • Forward secrecy: ephemeral session keys mean a stolen long-term private key does not expose recorded past traffic.
This is the answer to 'how can encryption be both secure and fast'. Asymmetric solves the key problem and symmetric solves the speed problem; the certificate is what makes the asymmetric half trustworthy.

Digital certificates and how one is acquired

A public key on its own is just a number: it cannot tell you whose key it is. A digital certificate is the file that binds a public key to an identity, and it is signed by a certificate authority (CA) - a body that both parties already trust. It contains the subject's name or domain name, the subject's public key, the name of the issuing CA, the validity dates, a serial number, the signature algorithm, and the CA's own digital signature over all of those fields.

Acquisition follows a fixed sequence. The organisation generates its key pair locally, so the private key never leaves its control. It then creates a certificate signing request (CSR), which contains its public key and identity details and is signed with its own private key to prove it holds the matching private key. The CSR is submitted to a CA, which verifies the identity claimed: for a basic domain-validated certificate the CA only checks that the applicant controls the domain, while organisation-validated and extended-validation certificates require company documents and sometimes a phone call. The CA then issues the certificate and signs it with the CA's private key. The organisation installs the certificate, and where an intermediate CA was used, the intermediate certificate as well.

Why anyone should believe the CA comes down to the chain of trust. Operating systems and browsers ship with a store of trusted root certificates, installed by the manufacturer. A root CA does not usually sign websites directly; it signs an intermediate CA, which signs the website's certificate. When a browser receives a certificate it follows the chain up to a root it already holds, checking each signature with the issuer's public key. If the chain reaches a trusted root, the site's public key is trusted - even though the browser has never heard of that site before.

Two practical points finish the picture. Certificates expire, which limits the damage if a key is later compromised, and they can be revoked before expiry if a private key leaks or an organisation closes; browsers check revocation lists or use the Online Certificate Status Protocol. A self-signed certificate, signed by its own key rather than by a CA, produces a browser warning and is only appropriate for internal testing. Free domain-validated certificates from Let's Encrypt, issued and renewed automatically through the ACME protocol, are why almost all web traffic is now encrypted.

Field in a certificateWhat it gives the relying party
Subject name and domainThe identity the key is claimed to belong to
Subject public keyThe key to use for encryption or for verifying the subject's signatures
Issuer (certificate authority)Who vouches for the binding of name to key
Validity datesThe period during which the certificate should be trusted
Serial numberA unique identifier, used when the certificate is revoked
CA's digital signatureProof that the CA issued this exact certificate; checked up the chain to a trusted root
A certificate does not encrypt anything. It carries a public key and an identity, and the CA's signature on the pair. If you are asked what a certificate does, the answer is 'proves which public key belongs to whom'.

SSL and TLS: purpose and use in client-server communication

SSL (Secure Sockets Layer) and its successor TLS (Transport Layer Security) are protocols that sit between the application layer and the transport layer and turn an ordinary, readable TCP connection into a secure one. SSL is the older name; SSL 2.0 and 3.0 are obsolete and insecure, and the versions in use are TLS 1.2 and TLS 1.3, though the term 'SSL' is still used loosely across the industry. Because it sits below the application, any application can use it: HTTPS is simply HTTP carried over TLS, normally on port 443, and the same protection is used for IMAPS and SMTPS for mail, FTPS for file transfer, and VPNs.

The purpose of TLS is to provide three guarantees for a connection over an untrusted network. Confidentiality: the data is encrypted with a symmetric session key, so anyone copying the packets learns nothing about the content. Integrity: each record carries a message authentication code, so a packet altered or injected in transit is detected and discarded rather than delivered. Authentication: the server presents a digital certificate, so the client knows it is talking to the real server and not to an impostor. The client can also present a certificate, which is how mutual TLS works between servers.

In client-server communication the guarantees are established during the handshake, before any application data is sent. The client sends a hello listing the TLS versions and cipher suites it supports; the server chooses and replies with its certificate; the client verifies the certificate against its trusted roots and checks the name matches the host it asked for; the two sides then establish the session key, either by the client encrypting a generated key with the server's public key or by Diffie-Hellman key agreement; and from then on both ends encrypt and decrypt with that symmetric key. The expensive asymmetric work happens once, and the bulk data uses the fast symmetric cipher.

When TLS is appropriate: any time credentials, payment details, personal data, messages or anything whose integrity matters crosses a network you do not control. Logging in anywhere, online banking and shopping, webmail, APIs carrying tokens, public Wi-Fi, and increasingly traffic between internal services on the grounds that the internal network is not automatically safe. When it adds little: transferring files between two machines on an isolated network with no confidentiality or tampering risk, or on hardware so constrained that the handshake cost matters more than the risk - though even there the trend is towards encrypting everything. It is also worth knowing what TLS does not do: it does not protect data stored on a server, it does not stop a legitimate server from being malicious or compromised, and it does not hide the fact that a connection happened or, in most configurations, which domain was visited.

GuaranteeHow TLS provides itWhat it stops
ConfidentialitySymmetric encryption of the data with a per-session keyEavesdropping - copied packets are meaningless
IntegrityMessage authentication over each record, using the session keyTampering and injection - altered data is rejected
AuthenticationThe server's digital certificate, verified up the chain of trustImpersonation and man-in-the-middle attacks
Forward secrecy (with ephemeral key exchange)A new session key per connection, discarded afterwardsDecryption of recorded traffic if a long-term key later leaks
Purpose of TLS in one line: it gives confidentiality, integrity and authentication to a connection over a network nobody controls. Say all three - most candidates stop at encryption and lose the other two marks.

Quantum cryptography: purpose, benefits and drawbacks

Quantum cryptography uses the behaviour of individual photons to distribute a key, so that its security rests on the laws of physics rather than on the difficulty of a mathematical problem. The practical technique is quantum key distribution (QKD): each bit of the key is encoded in the polarisation or phase of a single photon sent down a fibre-optic cable. An eavesdropper cannot copy an unknown quantum state - the no-cloning theorem - and cannot even measure it without disturbing it, so any attempt to read the key in transit leaves a detectable trail of errors.

The best-known protocol is BB84, published by Bennett and Brassard in 1984. The sender encodes each bit using one of two randomly chosen bases and records which basis was used; the receiver measures each photon using a randomly chosen basis of their own. The two then compare, over an ordinary public channel, which bases they used - not the values - and keep only the bits where the bases matched. They sacrifice a sample of the remaining bits to check the error rate: if it is above the level expected from noise, someone was listening, the key is thrown away and the process starts again. Eavesdropping is therefore not merely difficult but detectable, which is the whole point.

The benefits follow from that. Security does not depend on computational hardness, so a future quantum computer running Shor's algorithm - which would break RSA and elliptic-curve keys - does not threaten a QKD key. Interception is detected rather than hidden, so there is no silent compromise. And because a key can be discarded whenever the error rate is too high, recorded traffic cannot be attacked later with a key that was captured but not noticed, which matters for data that must stay confidential for decades.

The drawbacks are practical and severe. It needs specialised hardware - single-photon sources and detectors - and it is expensive. Range is limited, because photons are lost in optical fibre and, unlike a signal, cannot be amplified by a repeater without destroying the quantum state; long distances need trusted intermediate nodes or satellite links. Key rates are low, so QKD produces keys for symmetric ciphers rather than carrying data itself. It is point-to-point, not broadcast. It also still needs an authenticated classical channel to compare bases, so it solves key distribution but not authentication - that still needs certificates. Outside trial metropolitan networks and research links, deployment is very limited.

  • Purpose: distribute a symmetric key with security guaranteed by physics, not by computational difficulty.
  • Mechanism: single photons in randomly chosen bases; measuring disturbs the state, so eavesdropping shows up as errors.
  • Benefit: eavesdropping is detected, not just made hard; immunity to attack by a future quantum computer.
  • Benefit: a compromised key is discarded, so recorded traffic cannot be decrypted later.
  • Drawback: specialised, expensive hardware; short range because photons cannot be amplified.
  • Drawback: low key rates, point-to-point only, and it still needs an authenticated channel, so it does not replace certificates.
  • Drawback: not widely deployed; mainly trials and metro-scale networks.
Quantum cryptography is not 'using a quantum computer to break codes'. It is using quantum states to distribute keys, and its selling point is that interference becomes visible instead of invisible.

Key terms you must be able to define

Plaintext
The original, readable form of data before encryption. It is what an attacker wants to obtain and what encryption is designed to hide.
Ciphertext
The scrambled output produced by encrypting plaintext. It is meaningless to anyone who does not hold the correct key.
Encryption
The process of converting plaintext into ciphertext using an algorithm and a key, so that the data cannot be read if it is intercepted.
Key
The value that controls a cipher. The algorithm can be public; the security of the system depends on keeping the key secret and distributing it safely.
Symmetric key cryptography
Encryption in which the same single key is used to encrypt and to decrypt, so both parties must already share it. It is fast, but suffers from the key distribution problem and gives no non-repudiation. Example: AES.
Asymmetric key cryptography
Encryption using a mathematically related pair of keys: a public key that may be given to anyone and a private key that is never disclosed. Data encrypted with one can only be decrypted with the other. Example: RSA.
Public key
The key of an asymmetric pair that is published. It is used to encrypt data for the owner, or to verify a signature the owner has made.
Private key
The key of an asymmetric pair that is kept secret by its owner. It is used to decrypt data sent to the owner, or to create a digital signature that only the owner could produce.
Session key
The symmetric key generated for one connection in a hybrid system. It is distributed using asymmetric cryptography, used for the bulk data, and discarded when the session ends.
Digital signature
A hash of a message - a fixed-length digest from a one-way function - encrypted with the sender's private key. The receiver decrypts it with the sender's public key, recomputes the hash and compares, proving who sent the message and that it was not altered.
Digital certificate
A file, signed by a certificate authority, that binds a public key to an identity. It contains the subject's name, its public key, the issuer, the validity dates and the CA's signature.
Certificate authority (CA)
A trusted organisation that verifies an applicant's identity and signs its certificate, so that others can trust that a public key really belongs to the claimed owner.
SSL / TLS
Protocols that sit between the application and transport layers to give confidentiality, integrity and authentication to a client-server connection. SSL is obsolete; TLS 1.2 and 1.3 are in use. HTTPS is HTTP over TLS.
Quantum key distribution (QKD)
A method of distributing a key using single photons in quantum states. Measuring the photons disturbs them, so an eavesdropper is detected through the resulting error rate, and the key is discarded.

Applied to real systems

9618 sets its questions inside systems you already use - a phone, a school network, a supermarket till, a website, a bank. These show how to apply the theory to a context you have not seen before, then you write your own.

HTTPS on a banking website

When you type an address into a browser and a padlock appears, four things have just happened. The browser received the bank's certificate, checked the CA's signature up the chain to a root it already trusts, and confirmed that the domain name in the certificate matches the one requested. It then generated a session key, encrypted it with the bank's public key from that certificate, and sent it. From then on the page, your password and your card details travel encrypted with a fast symmetric cipher - typically AES - and each record carries a message authentication code so tampering is detected. This single connection contains every idea in the topic: symmetric and asymmetric cryptography, a digital certificate, and TLS doing the coordination.

Let's Encrypt and automated certificate acquisition

Let's Encrypt is a certificate authority that issues domain-validated certificates free of charge, and its ACME protocol automates the whole acquisition process. The server software generates a key pair locally, builds a certificate signing request, proves control of the domain by serving a token that the CA fetches over HTTP or by publishing a DNS record, and receives a signed certificate within seconds. Renewal happens automatically before expiry. The effect is visible in the proportion of web traffic now encrypted: acquisition used to involve paying a CA and pasting an email, and it is now a line in a server configuration.

Signed software updates

Operating system and package repositories sign their downloads rather than encrypt them, because the files are public. The publisher hashes the package, encrypts the hash with its private key, and ships the signature alongside. The installer decrypts the signature with the publisher's public key, recomputes the hash of the file it received, and compares. If a mirror or an attacker has altered a single byte, the hashes differ and the installation is refused. This is a clean demonstration that a digital signature gives authenticity and integrity without any confidentiality, and it is the reason a corrupted download fails loudly instead of installing quietly.

End-to-end encrypted messaging

Messaging applications such as Signal and WhatsApp use a hybrid design in which the keys belong to the users' devices rather than to the company's servers. Asymmetric cryptography is used to agree shared secrets when a conversation starts, and symmetric cryptography then encrypts every message, with the keys changed regularly as the conversation continues. Because the server only relays ciphertext, it cannot read the messages even if it wanted to, and a stolen server database does not expose past conversations. The remaining weak point is identity: the application can only show you a safety number or key fingerprint, which the two users must compare out of band to be sure there is no impostor in the middle.

Quantum key distribution in practice

QKD systems implementing BB84 have been demonstrated over hundreds of kilometres of optical fibre and, in satellite experiments, over much greater distances, and they are used in trial metropolitan networks where two sites need a key that no future computer could reconstruct. The hardware is the limit: single-photon detectors must be cooled and calibrated, the fibre must be dedicated rather than shared, and trusted nodes are needed to pass a key further than the physics allows in one hop. The honest assessment for an exam answer is that QKD is the strongest available answer to the threat a quantum computer poses to key exchange, and that its cost, range and key rate keep it out of ordinary web traffic.

Flashcards

Click a card to flip it. Mark honestly — the tracker uses this.

Q1Define plaintext, ciphertext, encryption and decryption.
Plaintext: the original readable data. Ciphertext: the scrambled output produced by encryption. Encryption: converting plaintext into ciphertext using an algorithm and a key. Decryption: converting ciphertext back into plaintext with the correct key. The cipher is the published algorithm; the key is the secret that must be protected.
Q2What is symmetric key cryptography, and what are its two weaknesses?
The same single key encrypts and decrypts, so both parties must already hold it. It is fast and is used for bulk data (AES with 128, 192 or 256-bit keys). Weaknesses: the key distribution problem - the key must reach the other party securely, and n users need n(n-1)/2 keys - and no non-repudiation, because both parties hold the same key so either could have produced a message.
Q3What is asymmetric key cryptography, and why is it slow?
It uses a mathematically related key pair: a public key anyone may have, and a private key that never leaves its owner. What one encrypts, only the other can decrypt, and the private key cannot feasibly be derived from the public one (RSA relies on the difficulty of factoring large primes). It is hundreds to thousands of times slower than symmetric encryption because it performs arithmetic on very large numbers, so it is used only for key exchange and signatures.
Q4How do you send a private message from the public to an individual or organisation?
The organisation publishes its public key. The sender encrypts the plaintext with that public key and sends the ciphertext. Only the organisation's private key can decrypt it, so only the organisation can read it - and no prior shared secret is needed. The sender cannot read back what they sent, which is the check that the right key was used.
Q5How do you send a verified message to the public?
The sender computes a hash of the message and encrypts that hash with their own private key; the result is the digital signature, sent with the message. The receiver decrypts the signature with the sender's public key, hashes the message as received, and compares the two. A match proves authenticity and integrity, and because only the sender holds that private key it also gives non-repudiation. It gives no confidentiality.
Q6Which key do you use to keep a message secret, and which to prove who sent it?
To keep it secret, encrypt with the recipient's public key - only their private key can decrypt it. To prove who sent it, encrypt (the hash) with your own private key - anyone can verify with your public key, but only you could have produced it. Real systems that need both sign first, then encrypt.
Q7Why do real systems use symmetric and asymmetric cryptography together?
Asymmetric solves key distribution but is too slow for bulk data; symmetric is fast but needs a shared key. So asymmetric cryptography is used once per connection to get a session key safely to the other side - or to agree one with Diffie-Hellman - and the session key then encrypts the data with a fast symmetric cipher such as AES. Ephemeral session keys also give forward secrecy.
Q8What does a digital certificate contain, and who signs it?
The subject's name or domain, the subject's public key, the issuing certificate authority, the validity dates, a serial number, the signature algorithm and the CA's digital signature. A certificate authority signs it after verifying the applicant's identity, which is what makes the public key trustworthy.
Q9How is a digital certificate acquired?
Generate the key pair locally; create a certificate signing request containing the public key and identity details, signed with the private key; submit it to a certificate authority, which verifies the identity - domain control for domain-validated, company documents for organisation or extended validation; the CA issues the certificate signed with the CA's private key; install it, with the intermediate certificate if one is used.
Q10What is the chain of trust?
Operating systems and browsers ship with trusted root certificates. A root CA signs an intermediate CA, which signs the website's certificate. The browser follows the chain upwards, verifying each signature with the issuer's public key, until it reaches a root it already holds - which is how a site it has never seen before can still be trusted.
Q11What is the purpose of SSL/TLS, and how is it used in client-server communication?
To give a connection over an untrusted network confidentiality (symmetric encryption), integrity (message authentication, so tampering is detected) and authentication (the server's certificate, verified up the chain of trust). In the handshake the client sends a hello, the server replies with its certificate, the client verifies it and a session key is sent encrypted with the server's public key or agreed with Diffie-Hellman, after which all data is encrypted symmetrically. HTTPS is HTTP over TLS on port 443.
Q12What is quantum key distribution, and what are its benefits and drawbacks?
A key is distributed using single photons whose polarisation or phase encodes each bit. Measuring disturbs the state (no-cloning), so an eavesdropper causes errors that the two parties detect when they compare a sample; the key is then discarded. Benefits: security rests on physics not computational difficulty, so it resists a future quantum computer, and eavesdropping is detected. Drawbacks: specialised expensive hardware, limited range because photons cannot be amplified, low key rates, point-to-point only, and it still needs an authenticated classical channel.
0 of 12 marked as known

Exam-style questions

8 questions, 25 marks. Write your answer, then reveal the mark scheme and tick each point you actually made. Answering honestly here is what makes the rest of the site useful.

StateAO11 mark
A customer wants to send a message to a bank so that only the bank can read it. State which key the customer should use to encrypt the message.

Mark scheme — tick each point you actually made

Examiner tip: One key, and it must be both the right type and the right owner. 'The public key' without saying whose is not precise enough for this question, and 'the private key' scores nothing.
DefineAO12 marks
Define the terms symmetric key cryptography and asymmetric key cryptography.

Mark scheme — tick each point you actually made

Examiner tip: The contrast is what earns the marks. Each definition must make clear how many keys are involved and who holds them.
DescribeAO13 marks
Describe how a digital signature is produced by the sender and how the receiver uses it to check a message.

Mark scheme — tick each point you actually made

Examiner tip: Do not say the whole message is encrypted with the private key. The signature is the hash encrypted with the private key, and the comparison of the two hashes is the step most candidates leave out.
ExplainAO22 marks
Explain why a digital certificate is needed even though a public key can simply be downloaded from a website.

Mark scheme — tick each point you actually made

Examiner tip: The first mark is for identifying the attack, the second for the mechanism that prevents it. Name the man-in-the-middle explicitly.
ExplainAO24 marks
Explain how symmetric and asymmetric cryptography are used together to protect a connection between a client and a server.

Mark scheme — tick each point you actually made

Examiner tip: Four distinct stages, in order: certificate, key exchange, symmetric data, and a point about why the split is necessary or what the fresh key adds. Answers that describe only one type of cryptography cannot score above half marks.
DiscussAO26 marks
Discuss the benefits and drawbacks of using quantum cryptography to distribute encryption keys, and whether it should replace current methods of key exchange.

Mark scheme — tick each point you actually made

Examiner tip: Two benefits and two drawbacks plus a mechanism and a judgement. The judgement is a mark in its own right: quantum cryptography solves key distribution, not authentication, so 'replace everything' is not a defensible conclusion.
DescribeAO13 marks
Describe how an organisation acquires a digital certificate from a certificate authority.

Mark scheme — tick each point you actually made

Examiner tip: Three steps in order: generate, request and verify, then install. Mentioning verification by the CA is what separates the answer from a description of generating a key pair.
ExplainAO24 marks
Explain the purpose of SSL/TLS and why its use is appropriate when a customer pays for goods on a website.

Mark scheme — tick each point you actually made

Examiner tip: The purpose is three guarantees, not one. The last mark comes from linking them to this situation: an untrusted network and data worth stealing.

Exam technique for this topic

  • Answer every key question in three parts: which key, whose key, and what that achieves. 'Encrypt with the receiver's public key so that only the receiver's private key can decrypt it, giving confidentiality' is a full-mark sentence; 'use encryption' is not.
  • Separate the two jobs before you start writing. Confidentiality means encrypting with the other party's public key. Authenticity and integrity mean encrypting with your own private key. If a question needs both, say so explicitly and put the steps in order - sign, then encrypt.
  • For digital certificates, always include the certificate authority and the chain of trust. A certificate is not encryption and does not encrypt data: it binds a public key to an identity and is signed by a CA that both sides already trust, which is what stops a man-in-the-middle publishing a fake key.
  • For TLS questions, give all three guarantees - confidentiality, integrity and authentication - then the handshake order: certificate and public key, verify, session key, symmetric encryption for the data. Naming HTTPS or port 443 alone will not earn the purpose marks.
  • For quantum cryptography, use the benefits and drawbacks as a matched pair. Benefit: eavesdropping is detected because measurement disturbs the photon state, and the key is discarded. Drawback: specialised hardware, limited range because photons cannot be amplified, low key rates, and an authenticated channel is still needed. A one-sided answer cannot reach the top marks.

Why students lose marks here

A student wroteA student wrote: 'To send a confidential message to a company, encrypt it with the company's private key so that only the company can read it.'
Why it loses marksThe private key is the one thing that must never be given out, so the sender could not have it. If the message really were encrypted with the company's private key, anyone holding the published public key could decrypt it, so the result is the opposite of confidential - and the company would have had to disclose its private key to make it possible.
The answer that scoresThe sender obtains the company's public key, which is published and may be given to anyone, and encrypts the message with it to produce ciphertext. Only the matching private key, which the company keeps secret, can decrypt that ciphertext, so the message is confidential even though the ciphertext crosses a network the sender does not control. This scales to the public because the public key can be published to the whole world without weakening the encryption: it can lock data but cannot unlock it. The weakness is that the sender has no proof the public key really belongs to the company, which is the problem a digital certificate solves.
A student wroteA student wrote: 'A digital certificate encrypts the data sent to a website, so the connection is secure.'
Why it loses marksA certificate is a signed statement of identity, not a cipher. It contains the subject's name, its public key, the issuer, the validity dates and the CA's signature. It encrypts nothing; the encryption is done by TLS using a session key, and the certificate's role is to make the owner of that public key trustworthy.
The answer that scoresA digital certificate binds a public key to an identity and is signed by a certificate authority that the client already trusts. It contains the subject's name or domain, the subject's public key, the issuer, the validity dates, a serial number and the CA's digital signature. During the TLS handshake the server presents the certificate; the client checks the CA's signature up the chain of trust to a root certificate in its own trust store and checks the domain name matches, so it knows the public key belongs to the real server and not to an impostor. The encryption is a separate step: the client uses that now-trusted public key to send a session key, or agrees one with Diffie-Hellman, and the data is then encrypted symmetrically. The certificate prevents a man-in-the-middle attack; it does not itself encrypt.
A student wroteA student wrote: 'SSL/TLS encrypts the data on the web server, so if the server is stolen the customer details are still safe.'
Why it loses marksTLS protects data in transit, between the client and the server. Once the data is decrypted at the server it is stored in whatever form the application chooses, and nothing in TLS protects it there. Data at rest needs separate encryption, usually full-disk or database-level.
The answer that scoresSSL/TLS protects a connection between a client and a server: it gives confidentiality by encrypting the data with a symmetric session key, integrity by authenticating each record so alterations are detected, and authentication by the server presenting a digital certificate that the client verifies up the chain of trust. When the data reaches the server it is decrypted so the application can use it, and from then on it is only as safe as the server's own storage controls - access rights, database encryption and backups. TLS also does not protect against a server that is itself malicious or already compromised, and it does not hide the fact that a connection took place. A complete answer to 'how are customer details protected' names both transit encryption and encryption at rest.
A student wroteA student wrote: 'Asymmetric encryption is more secure than symmetric, so it should be used for all the data in a secure connection.'
Why it loses marksAsymmetric cryptography is not more secure in any absolute sense; 256-bit AES is not weaker than 2 048-bit RSA. Its advantage is solving key distribution. Its disadvantage is that it is hundreds to thousands of times slower, because it performs arithmetic on very large numbers - which makes it unusable for bulk data such as video or a whole web page.
The answer that scoresThe two types are used together, each for what it does best. Asymmetric cryptography solves the key distribution problem: the server publishes a public key inside its certificate, and the client uses it to send a randomly generated session key, or agrees one using Diffie-Hellman, without any shared secret existing beforehand. Symmetric cryptography then encrypts the actual data with that session key, using AES, because it is fast enough for bulk traffic. The asymmetric operation happens once per connection and the symmetric cipher handles everything else, so the connection has the security of the first and the speed of the second. Ephemeral session keys also give forward secrecy, because a new key is generated for each connection and discarded afterwards.
A student wroteA student wrote: 'Quantum cryptography uses a quantum computer to break existing encryption, and its main drawback is that quantum computers are expensive.'
Why it loses marksThat describes the threat that motivates quantum cryptography, not the technique. Quantum cryptography - specifically quantum key distribution - uses quantum states to distribute a key, and its main drawbacks are practical: specialised hardware, limited range because photons cannot be amplified, and low key rates.
The answer that scoresQuantum key distribution distributes a symmetric key by encoding each bit in the polarisation or phase of a single photon. An eavesdropper cannot copy an unknown quantum state and cannot measure it without disturbing it, so interception introduces errors that the two parties detect when they compare a sample of the key over a public channel; if the error rate is too high the key is discarded and the process restarts. Its benefits are that security rests on physics rather than on computational difficulty, so it is not threatened by a future quantum computer, and that eavesdropping is detected rather than hidden. Its drawbacks are that it needs specialised and expensive single-photon hardware, that range is limited because photons are lost in fibre and cannot be amplified, that key rates are low, that it is point-to-point, and that it still requires an authenticated classical channel - so it does not remove the need for certificates.