Digital signatures: proving who sent it

7 min 5 sections 4 practice questions 4 sources citedISC2 objective 3.6

A digital signature does for a file what a handwritten signature and a tamper-proof seal do together for a paper contract. It shows that the content has not changed since it was signed and that it came from the holder of one particular private key. Because only the signer holds that key, the signer cannot credibly deny it later. No background beyond public keys and hashes is assumed. Signatures protect contracts, software updates and every certificate on the web.

By the end of this unit you will be able to:

  • Tell apart a hash, a message authentication code and a digital signature by what each proves
  • Put in order the steps of creating and verifying a digital signature, and explain what a failed check means
  • Explain non-repudiation and choose the practices that keep it or break it
  • Choose between signing, encrypting and doing both for a given requirement
  • Explain what a digital certificate binds together and why a signature needs one

An order for timber that nobody admits sending

An illustrative example

A builders' merchant receives an emailed order for 40,000 pounds of timber from a regular customer. The email comes from the customer's usual address and quotes their account number. The merchant delivers.

The customer refuses to pay. They say they never sent the order, and that anyone could have typed their address and account number. The merchant has no way to show otherwise.

What would the merchant need, attached to the order, to prove in a dispute who sent it and that nobody changed it?

A shared-key seal: the MAC and HMAC

A bare detects accidental change. An attacker who changes a message simply calculates a new hash. To detect deliberate change, the check value must depend on a secret the attacker lacks.

A message authentication code (MAC) is a short check value calculated from a message and a that sender and recipient share. The recipient recalculates it with the same key and compares. An altered message, or one from someone without the key, fails.

HMAC (keyed-hash ) builds a MAC from an approved hash function, such as SHA-256, and a shared secret key.

A MAC proves the message came from someone holding the key. Two parties hold it, so a MAC cannot show which of them wrote the message.

Payment files between two offices

A firm's head office sends a payment file to its bank every night. Both hold the same HMAC key. The bank recalculates the HMAC on each file and rejects any file whose value does not match.

An attacker on the network who changes one account number cannot produce a matching value without the key. If the bank later claims the firm sent a different file, however, the HMAC cannot settle it: the bank holds the key too.

Hash, HMAC and digital signature: what each one proves
ToolKeyIntegrityWho sent itProof to a third party
HashNoneAgainst accident onlyNoNo
HMACOne secret key, sharedYesOne of the key holdersNo
Digital signatureSigner's private key; anyone checks with the public keyYesThe private key holderYes:

Signing and verifying, step by step

A digital signature is a value calculated from a message's digest and the signer's private key, which anyone can check with the signer's public key.

  1. Signing 1: the signer hashes the message to get its digest.
  2. Signing 2: the signer's software combines the digest with the signer's private key to produce the signature. With RSA this step is often described as the digest with the private key.
  3. Signing 3: the message and the signature are sent together. The message itself is not hidden.
  4. Verifying 1: the recipient hashes the message as received, with the same hash function.
  5. Verifying 2: the recipient uses the signer's public key to check the signature against that new digest.
  6. Verifying 3: a match means the message is unchanged and was signed with the matching private key.

A signature is made with one key and checked with the other

A signature is made with one key and checked with the otherSigning along the top: the message is hashed to a digest, and the signer's private key turns the digest into a signature. Verifying along the bottom: the message is hashed again, and the signer's public key checks the signature against the new digest.MessagesentreadableDigestsigner's hashSigner'sprivate keySignaturewith messageNew digestverifier's hashSigner'spublic keyCheckmatchor failA signature is made with one key and checked with the otherSigning along the top: the message is hashed to a digest, and the signer's private key turns the digest into a signature. Verifying along the bottom: the message is hashed again, and the signer's public key checks the signature against the new digest.MessagesentreadableDigestsigner's hashSigner'sprivate keySignaturewith messageNew digestverifier's hashSigner'spublic keyCheckmatchor fail
Read this figure as text

A digital signature is a value calculated from a message's digest and the signer's private key, which anyone can check with the signer's public key. The message itself is not hidden.

  1. Signing 1: the signer hashes the message, for example with SHA-256, to get its digest.
  2. Signing 2: the signer's software combines the digest with the signer's private key, which only the signer holds, to produce the signature.
  3. Signing 3: the message and the signature are sent together, and the message can be read by anyone.
  4. Verifying 1: the recipient hashes the message as received, with the same hash function, to get a new digest.
  5. Verifying 2: the recipient uses the signer's public key, taken from the signer's certificate, to check the signature against the new digest.
  6. Verifying 3: a match means the message is unchanged and was signed with the matching private key.
  7. A failure means the message changed after signing, the signature was made with a different private key, or the public key is not the signer's. The check cannot say which, so the message is rejected.

Hashing first keeps the slow public key step small: a 64-page contract and a one-line note each give one short digest to sign.

A failed check means one of three things: the message changed after signing, the signature was made with a different private key, or the public key used to check is not the signer's. The check cannot say which, so the message is rejected.

What a signature proves, and what breaks it

A valid signature gives , of the signer, and non-repudiation: evidence that a third party, such as a court, can check that the claimed signer signed. It gives no .

Non-repudiation holds only while one person alone controls the private key. It is lost when the signing key is shared among staff, when a copy is lodged with a third party, or when the evidence is an HMAC. The National Institute of Standards and Technology (NIST), the United States standards body, advises that private signing keys are not, in general, archived, for this reason.

The Digital Signature Standard, the United States federal standard for signatures, approves three : RSA, the Elliptic Curve Digital Signature Algorithm (ECDSA) and the Edwards-curve Digital Signature Algorithm (EdDSA). The older Digital Signature Algorithm (DSA) may now only check signatures made in the past.

Time-stamping
A trusted time-stamping service signs the message's digest together with the current time. This proves the signature existed at that moment, for example before the signer's key was withdrawn. The service sees only the digest.
Code signing
A software publisher signs each program or update. The computer checks the signature before installing, so altered or impostor software is refused.

Signing is not encrypting

Signing uses the sender's private key and leaves the message readable. Encrypting for confidentiality uses the recipient's public key and hides the message. They answer different needs and are often combined.

To do both, the sender signs the message with the sender's own private key, then encrypts the message and signature with the recipient's public key, or with a session key in a digital envelope. The recipient , then verifies.

Each person should have two key pairs: one for signing and one for encryption. NIST's rule is that a key serves only one purpose. An encryption key may need a backup so that files can be recovered, while a signing key should have no copy, so that the signature stays the owner's alone.

Sign with the sender's private key. Encrypt with the recipient's public key. Two jobs, two key pairs for each person.

Common misconception

“A signed email is protected from being read.”

A signature proves origin and integrity. The message travels in readable form unless it is also encrypted.

A certificate answers "whose key is this?"

A signature proves the message was signed with the private key matching a public key. It proves nothing about a person until the recipient knows whose public key that is. An impostor can publish a public key under someone else's name.

A digital certificate is a signed statement, issued by a trusted body called a , that binds a name to a public key for a stated period.

A certificate compared with a passport
PassportDigital certificate
Issued by a government passport officeIssued and signed by a certificate authority
Holder's name and photographSubject's name and public key
Valid from and to datesValidity period: not before, not after
Security features that resist forgeryThe authority's over every field
Can be cancelled before expiryCan be revoked before expiry

The recipient checks the authority's signature on the , then uses the public key inside it to check the signature on the message. The merchant in the timber dispute would have needed both.

Worked example: Three outcomes of checking a signed contract

A supplier emails a signed contract to a hotel group. The hotel group's software verifies it with the supplier's public key, taken from the supplier's certificate.

  1. Case 1: the digest of the received contract matches what the signature attests. The contract is unchanged and was signed with the supplier's private key. It is accepted.
  2. Case 2: someone changed the price on page 3 in transit. The new digest differs completely, because of the avalanche effect. The check fails, and the contract is rejected.
  3. Case 3: the contract arrives unchanged, but the signature was made by an impostor's private key. The supplier's public key does not match it. The check fails.
  4. In cases 2 and 3 the software reports the same failure. The hotel group asks the supplier to send it again by a trusted route.

Verification answers one question: was this exact content signed with the private key that matches this public key. It cannot tell an alteration from a forgery, and it needs no secret from the verifier.

A question, worked through

A hospital's prescribing system sends drug orders to the pharmacy system. After a disputed order, the medical director requires that every order can be shown to have come from the individual doctor who placed it, so that no doctor can later deny an order. Each doctor already signs in with a smart card holding a private key.

Which mechanism BEST meets the medical director's requirement?

  1. A digital signature on each order made with the doctor's private key on the card
  2. An HMAC on each order made with a key the two systems share between them
  3. A SHA-256 digest of each order stored by the pharmacy beside the order
  4. AES-GCM encryption of each order under a key held by the pharmacy system
Decide on your answer, then open the reasoning
  1. The requirement is non-repudiation by an individual: proof, to a third party, of which doctor placed the order.
  2. Rule out c. A digest has no key, so anyone who alters an order can recalculate it.
  3. Rule out d. Encryption keeps orders secret and detects changes in transit, and the pharmacy's key belongs to the pharmacy, not to a doctor.
  4. Between a and b: an HMAC proves the order came from a holder of the shared key. Two systems hold it, and no doctor is named by it.
  5. Only a key held by one doctor alone can show that doctor signed. Option a uses the private key on each doctor's card.

Answer: A. A digital signature on each order made with the doctor's private key on the card

Choosing between good answers

A requirement says the sender must not be able to deny sending
choose a digital signature. An HMAC or a shared key cannot give non-repudiation.
Two parties who trust each other need tamper detection with a shared key and no third party
an HMAC is enough and is faster than a signature.
A question asks which key creates a signature
it is the sender's private key. The sender's public key verifies it.
An option proposes backing up or escrowing a person's signing key
be wary. It weakens non-repudiation. Escrow suits encryption keys.
An option describes encrypting the digest with the sender's private key
it is describing how a signature is made.

Check your understanding

4 questions on this unit, easiest first. Confirm an answer to see the reasoning for it, then the right answer, the other options and the rule to reuse. Your answers are kept in this browser and feed readiness and review.

These questions are drafts that no named reviewer has approved yet.

Question 1 of 4

A software publisher wants customers' computers to refuse any update that was altered after release or issued by an impostor. Which mechanism provides this?

What to remember

  • A hash detects accidental change. An HMAC detects deliberate change between holders of a shared key. A signature adds proof of the signer to a third party.
  • To sign: hash the message, then apply the private key to the digest. To verify: hash the message as received and check the signature with the signer's public key.
  • A signature gives integrity, authenticity and non-repudiation, and no confidentiality.
  • Non-repudiation fails when the signing key is shared, copied to a third party, or replaced by a shared-key MAC.
  • The Digital Signature Standard approves RSA, ECDSA and EdDSA. DSA may only verify old signatures.
  • A certificate is a certificate authority's signed statement binding a name to a public key.

Say it from memory

  1. How is a digital signature created and verified, what does it prove, and what does a digital certificate add?

    The signer hashes the message and applies the private key to the digest. The verifier hashes the received message and checks the signature with the signer's public key. A match proves integrity, the signer's authenticity and non-repudiation, but not confidentiality. A certificate is a certificate authority's signed statement that binds the signer's name to that public key, so the verifier knows whose key it is.

    Read this part again

  2. What does an HMAC prove, and why can it not give non-repudiation?

    An HMAC is built from an approved hash function and a shared secret key. It proves the message is unchanged and came from someone holding the key. Two parties hold the key, so it cannot show which of them wrote the message, and it cannot settle a dispute before a third party.

    Read this part again

  3. When is non-repudiation lost, and which algorithms does the Digital Signature Standard approve?

    Non-repudiation holds only while one person alone controls the private key. It is lost when the signing key is shared among staff, when a copy is lodged with a third party, or when the evidence is an HMAC. The Digital Signature Standard approves RSA, ECDSA and EdDSA; DSA may now only check past signatures.

    Read this part again

  4. Why should each person have two key pairs, one for signing and one for encryption?

    NIST's rule is that a key serves only one purpose. An encryption key may need a backup so that files can be recovered. A signing key should have no copy, so the signature stays the owner's alone.

    Read this part again

  5. What is a digital certificate, and why is one needed for a signature to prove who signed?

    A signed statement, issued by a certificate authority, that binds a name to a public key for a stated period. A signature proves only that the matching private key was used. An impostor can publish a public key under someone else's name, so the recipient needs the certificate to know whose key it is.

    Read this part again

Sources