Edexcel International Advanced Level Computer Science, point 16.1.1
This builds on encryption (3.2), asymmetric keys and RSA (3.2.2, 12.3.2) and TLS (12.1.2). Encryption keeps data secret. Here the aims are to prove who sent a message (authentication), to show it was not altered (integrity), and to stop the sender denying it (non-repudiation).
a. Digital signatures and certificates
Digital signature
Definition
A digital signature is a value, calculated from a message and the sender's private key, that proves the message came from the owner of that key and has not been changed. It is the digital equivalent of a handwritten signature plus a tamper-proof seal.
Function and why needed
When you receive a document, a software download or an online payment instruction, you need to know who really sent it and that nobody changed it on the way. Encryption alone doesn't prove this.
Operation
- The sender calculates a hash digest of the message (below).
- The sender encrypts the digest with their private key. The result is the digital signature.
- The message and the signature are sent (the message may also be encrypted for secrecy).
- The receiver decrypts the signature with the sender's public key, giving the digest the sender calculated.
- The receiver calculates their own hash digest of the received message.
- If the two digests match, the message is genuine and unchanged. If not, it has been altered, or didn't come from that sender.
Why it works: only the owner of the private key could have made a signature that the public key decrypts correctly, and any change to the message changes the digest, so the two won't match.
Note the reversal: for confidentiality, the sender uses the receiver's public key to encrypt and the receiver's private key decrypts. For a signature, the sender's private key signs and the sender's public key checks.
Digital certificate
Definition
A digital certificate is an electronic document that binds a public key to the identity of its owner (a person, website or company), signed by a trusted third party called a certificate authority (CA).
Function and why needed
How do you know that a public key really belongs to the bank you think it does? An attacker could publish their own key in the bank's name (a man-in-the-middle attack). A certificate solves this: a trusted CA has checked the owner's identity and vouches for the key.
Contents of a certificate
| Field | Meaning |
|---|---|
| Subject | Who the certificate is for (for example www.example.com) |
| Subject's public key | The key being certified |
| Issuer | The certificate authority that signed it |
| Validity period | Start and expiry dates |
| Serial number | A unique identifier |
| Digital signature of the CA | The CA's signature over all of the above |
Operation (a browser visiting https://...)
- The server sends its certificate.
- The browser checks that: the certificate is signed by a CA it trusts (browsers hold a list of trusted CAs' public keys), it is in date, it is for this website's name, and hasn't been revoked.
- If all is well, the browser trusts the server's public key and continues the TLS handshake (12.1.2).
- If not, the browser shows a warning.
Chain of trust: a certificate may be signed by an intermediate CA, which is itself certified by a root CA that the browser trusts.
b. Hash digest and use of public/private keys
Hash digest
Definition
A hash function takes any amount of data and produces a fixed-length value called a hash digest (or hash, message digest). SHA-256 gives a 256-bit digest (64 hex characters).
Characteristics of a cryptographic hash function
- Deterministic: the same input always gives the same digest.
- Fixed length: any input gives the same size of output.
- One way: you can't work out the original data from the digest.
- Avalanche effect: a tiny change in the input changes the digest completely.
- Collision resistant: it is practically impossible to find two different inputs with the same digest.
- Fast to calculate.
Uses
- Digital signatures (above): sign the short digest instead of the long message (faster).
- Checking file integrity (download checksums).
- Storing passwords (store the hash, not the password, with a salt).
- Blockchain (16.1.2).
Using public and private keys with the digest
A toy example with the small RSA numbers from 12.3.2 (, public , private ):
What happens:
- Signing: digest, then raise to the power (private key).
- Verifying: raise the signature to the power (public key), and compare with the digest of the received message.
- A changed message gives a different digest, so the check fails.
Summary of key use
| Goal | Who uses which key |
|---|---|
| Confidentiality (secret message to Sam) | Sender encrypts with Sam's PUBLIC key. Sam decrypts with his PRIVATE key |
| Authentication and integrity (a signed message from Priya) | Priya signs the digest with her PRIVATE key. Anyone checks with her PUBLIC key |
| Both | Sign with your private key, then encrypt with the receiver's public key |
Benefits
- Proves who sent the message (authentication).
- Detects any change (integrity).
- Non-repudiation: the sender can't later deny sending it.
- Builds trust in online communication (HTTPS, software updates, e-contracts).
- Efficient: only the short digest is signed.
Drawbacks
- Relies on trust in certificate authorities: a compromised CA can issue false certificates.
- Private keys must be kept secret: if stolen, an attacker can sign as the owner.
- Certificates expire and must be renewed; revocation is hard to check quickly.
- Needs infrastructure (CAs, key management), and a cost for some certificates.
- Weak or broken hash functions (such as MD5) undermine the signature.
- A signature doesn't hide the content (use encryption as well for secrecy).
Worked example
Task: Sam receives an email with a software update and a digital signature supposedly from the software company. Explain how Sam checks it is genuine.
- Sam gets the company's public key from its digital certificate, which a trusted CA has signed. The certificate proves the key belongs to the company.
- Sam's computer decrypts the signature with the company's public key, giving digest A.
- It calculates a hash digest of the update it received: digest B.
- If A = B, only the holder of the company's private key could have produced that signature, and the update hasn't been changed. If A is not equal to B, the update was altered (or forged), and Sam should not install it.
Exam tip: learn the signature steps in order (hash, encrypt the digest with the private key, send, decrypt with the public key, compare digests). Don't mix up which key does what: signing uses the private key, confidentiality uses the receiver's public key to encrypt. Say what a certificate proves (the public key belongs to this owner, vouched for by a CA).
Check yourself
What does a digital signature prove?
Who sent the message (authentication) and that it hasn't been changed (integrity); the sender also can't deny sending it.
Which key is used to create a digital signature, and which to check it?
The sender's private key creates it and the sender's public key checks it.
What is a digital certificate, and who issues it?
An electronic document binding a public key to the identity of its owner, signed by a trusted certificate authority.
Give two properties of a cryptographic hash function
Any two of: same input gives same output; fixed-length output; one way; a small change gives a completely different digest; collision resistant.
Why is the digest signed instead of the whole message?
It is much shorter, so signing and checking are much faster.