Pebellslearn by building
0%
RoadmapsMatrixCoursesSandboxSign in
Identity, Access and Cryptography  ›  Capstone Project

Public Keys, Private Keys and Certificates

Private vs Public Keys 15 minPublic-key cryptography uses a shareable public key and a secret private key, for encrypting to someone or signing as someone, and certificates in a PKI bind public keys to names.

Public Keys, Private Keys and Certificates

Back in the TLS lesson, the shop's website proved its identity with a certificate. But how can a server prove who it is to millions of strangers without sharing a secret with each one first? The answer is a pair of mathematically linked keys.

The rule

Share the public key with everyone; guard the private key with your life.

Asymmetric (public-key) cryptography gives each owner a key pair:

  • The public key can be given to anyone.
  • The private key stays only with its owner and is never shared.

They work as a team in two directions:

  • Encrypt for someone — anyone encrypts with the owner's public key; only the owner's private key can decrypt it. Like a letterbox: anyone can post, only the keyholder opens it.
  • Sign as someone — the owner signs with their private key; anyone checks the signature with the public key. Like a wax seal only you can make but everyone can recognise.

The other kind, symmetric encryption, uses one shared key for both locking and unlocking. It is fast, so real systems use public keys to agree a shared key safely (key exchange), then switch to symmetric encryption for the bulk of the data. That is exactly what the TLS handshake does.

A public key alone does not say whose it is. A certificate binds a public key to a name, like hollowoakbooks.example, and is signed by a certificate authority (CA). Browsers trust a set of CAs, and CAs check who they issue to. This whole system of CAs, certificates and trust is called PKI (public key infrastructure).

The shortcut

Ask "Is this about secrecy or proof?" Secrecy: encrypt with the recipient's public key. Proof: sign with your own private key.

How the shop's certificate worksStep 1 of 4
  1. Key pair

    The web server generates a key pair and keeps the private key on the server only.

If the private key leaks, anyone could pose as the shop. It must be replaced and the old certificate revoked. Never email private keys or save them in shared folders.

Drills

Answer fast — trust the rule.

quick drill

A supplier wants to send Priya a secret file. Which key should they encrypt it with?

quick drill

Which key does the shop's server use to sign, proving it is really the shop?

quick drill

What does a certificate do?

quick drill

The web server's private key is accidentally posted online. What should happen?

quick drill

Why does TLS switch to a symmetric key after the handshake?

Remember

  • Share the public key with everyone; guard the private key.
  • Secrecy: encrypt with the recipient's public key. Proof: sign with your private key.
  • Certificates bind keys to names through PKI. Trap: leaking or sharing a private key.

Practice — level up

0/1 solved

Write your answer, then compare it with a rubric and a model answer.

ExplainSecrecy or proof?

Explain how public and private keys let the shop's website prove its identity to a customer's browser, what a certificate adds, and what the shop must do if its private key is ever exposed.