bastion

Digital Signatures and Certificates

Build this skill

Predict whether a digital signature or certificate check passes, and explain what a valid signature and a certificate authority do and do not prove.

Is this update really from Rathi Softech?

At 1 am every Sunday, the fourteen billing laptops at Tulsi Health check for a new MedLedger update and install it without anyone watching. That is convenient, and it is also a huge act of trust: an update can change anything on the laptop. Before installing, each laptop needs answers to two questions. Did this file really come from Rathi Softech, and has anyone changed even one character of it since? Comparing a fingerprint of the file is not enough on its own, because an attacker who can swap the file might also swap the fingerprint published next to it. The tool that answers both questions at once is a digital signature.

A stamp only one hand can make

A digital signature relies on a key pair, two linked keys created together. The private key is kept secret by its owner, here Rathi Softech, and never shared. The public key can be given to anyone, and Rathi Softech builds it into every copy of MedLedger. The two are linked by mathematics so that something made with the private key can be checked with the public key, but the public key cannot be used to make it.

Think of a notary's stamp on an affidavit. Anyone at the bank or the court can recognise the notary's seal and see that it is genuine, but only the notary holds the stamp that makes it. A digital signature works the same way, with one extra feature. It is tied to the exact content of the document, so if a single word changes after signing, the seal no longer fits.

Signing happens in two steps. Rathi Softech first computes the file's hash, a short fixed-length fingerprint that changes completely if the file changes. It then uses its private key to turn that fingerprint into the signature, and ships the signature alongside the file. Checking reverses the roles. The laptop computes its own fingerprint of the file it received, then uses Rathi Softech's public key to test whether the signature belongs to that fingerprint.

Update fileMedLedger 4.3FingerprintSHA-256 hashSignRathi's privatekeyShip bothfile +signatureVerifyRathi's publickey

The first three steps happen at Rathi Softech. The last happens on every laptop, using only the public key, which is safe to share.

What a signature proves, and what it does not

A signature that checks out gives two guarantees. The first is authenticity: the file was signed by whoever holds Rathi Softech's private key, so it is not a stranger's file wearing Rathi's name. The second is integrity: the file has not changed since it was signed, because any change gives a different fingerprint and the signature stops matching. The process of checking both is called integrity verification, and it is why tampered downloads and fake updates are rejected automatically rather than relying on someone noticing.

There is also a limit, and it is easy to miss. A signature proves which key signed the file, not that the file is safe. If an attacker steals the private key, everything they sign will pass. If criminals sneak harmful code into Rathi Softech's own build system before signing, the harmful update gets a genuine signature too. This is why vendors keep signing keys in special locked-down hardware, and why a valid signature is one check among several, not the end of all checking.

Walk through four overnight updates below. Each one pauses at the moment the laptop checks the signature and asks you to predict the result before you see it.

Whose public key is this? Certificates

Everything so far assumed the laptop already had Rathi Softech's genuine public key. On the open internet that is the hard part. When your browser connects to tulsihealth.in, how does it know the public key it receives belongs to Tulsi Health and not to an impostor who sent their own? The answer is a digital certificate: a small electronic document that says "this public key belongs to this name", and is itself signed by an organisation that checked the claim.

Your college ID card is the everyday version. Your name and photo are on it, but the gate guard believes it because the principal issued it and the college seal is on it, not because you say so. A certificate holds the subject (the name, such as tulsihealth.in), the subject's public key, the issuer who vouches for it, dates between which it is valid, and the issuer's digital signature over all of it.

Tulsi Institute of Technology NAME Riya Menon ISSUED BY The Principal VALID TILL June 2027 Principal's seal The gate guard trusts the principal, so the card is believed who ↔ vouched by ↔ expires ↔ Digital certificate NAME (SUBJECT) tulsihealth.in ISSUED BY Sahyadri Trust CA VALID TILL 12 Mar 2027 PUBLIC KEY 04a1 9c3e 77b0 … CA signature ✓ Your browser trusts the CA, so the name-to-key link is believed

A certificate is an ID card for a website. The name, the issuer and the expiry date line up; the CA's signature plays the part of the principal's seal.

Certificate authorities and the chain of trust

The organisations that issue certificates are called certificate authorities, or CAs. Before issuing a certificate for tulsihealth.in, a CA must check that the person asking really controls that domain name, the name part of a web address, for example by asking them to place a specific code on the website. Some certificates involve deeper checks of the company itself, but the basic check is about control of the name.

Your phone and laptop come with a short built-in list of root CAs, top-level authorities that the makers of your operating system and browser have vetted, kept in what is called the trust store. Root CAs rarely sign website certificates directly. They sign certificates for intermediate CAs, which then sign the certificates websites use. Your browser follows this chain of trust upwards, checking each signature, until it reaches a root it already trusts.

Sahyadri Root CAin your trust storesignsSahyadri Issuing CAintermediatesignstulsihealth.inwebsite certificatesignsadmin.tulsihealth.inwebsite certificatesignsSahyadri Code CAintermediatesignsRathi Softechcode-signingcertificate

The browser checks each signature on the way up. If the chain does not end at a root it already trusts, the certificate is rejected.

Certificates fail in recognisable ways. A certificate may have expired, its name may not match the site you asked for, or its chain may lead to an issuer your device does not trust. A certificate can also be revoked, cancelled early by the CA, for instance when its private key is stolen. In each case the browser shows a full-page warning. Sometimes the cause is an honest mistake, but the same warning is exactly what you see when someone on the network is trying to sit between you and the real site, so the safe response is to stop rather than click past it.

Decide what Rohan should do in the situation below.

Follow your curiosity.

↑ ↓ to explore · Enter to open · Escape to close