Public-key cryptography and digital signatures

Unit 4 of 5 in Cryptography basics.

You will be able to explain what a digital signature proves and what it does not.

Lesson

Two keys instead of one

Symmetric encryption has a problem: both sides need the same secret key, and you have to get it to them safely. Public-key cryptography uses a pair of keys. The public key may be known by anyone. The private key must be kept secret by its owner.

That is what lets strangers trust each other: you can publish your public key and never share the private one.

Digital signatures

FIPS 186-5 specifies algorithms for digital signatures. Signature generation uses a private key; signature verification uses the matching public key, which is not the same as the private key. Anyone can verify with the signatory's public key. The standard says digital signatures are used to detect unauthorized modifications to data and to authenticate the identity of the signatory, and that the recipient can use a signature as evidence to a third party that the signatory made it, which is called non-repudiation.

What a signature does not prove

A signature ties data to a private key. It proves that whoever held the key signed exactly these bytes. It does not prove that the signed software is safe, only that it came from the key holder unchanged. If an attacker tampers with software before it is signed, or steals the private key, the signature is still valid. That is why protecting private keys and the build process matters as much as the signature check.

Key agreement and use libraries

Public-key methods are also used to agree on a fresh shared secret between two parties who have never met. TLS 1.3 does this with a key exchange based on ephemeral Diffie-Hellman, then uses the shared secret with fast symmetric encryption for the data. Do not implement any of this yourself. OWASP's guidance for developers is to use a maintained library and a well-reviewed padding scheme rather than assembling raw primitives.

Key points

Sources

Practice in the labs

Use public-key tools in everyday forms: an encrypted messenger, a signed SSH login and a website you check before you trust.

Knowledge check

  1. Which key makes a digital signature, and which verifies it? Answer: The private key signs and the public key verifies. FIPS 186-5: signature generation uses a private key; verification uses the corresponding public key.
  2. A program is signed with a valid signature. What does that prove? Answer: The key holder signed exactly these bytes. A signature authenticates the signer and detects modification after signing. It says nothing about whether the signed code is safe.
  3. What does non-repudiation mean for a signature? Answer: The signer cannot easily deny having signed. FIPS 186-5 describes non-repudiation as the signatory not being able to easily repudiate the signature at a later time.

Back to the syllabus or see all classes.

Related