Corp Apps training · 45 minutes

Locks, keys and
certificates

Public-key crypto, PKI and TLS for the people who run our web, app and SQL servers.

Press → to advance · N for notes · F for fullscreen

Monday, 8:02 AM

🐶☕
This is fine.
🔥

The cert expired Saturday. Monitoring: none. Users: many.

Today

Four parts, one goal: no more mystery cert errors

🔑

Crypto basics

Shared keys, key pairs, signatures, hashes

🪪

Certificates

What’s inside, chain of trust, public vs internal CAs

🤝

TLS

What it gives you and what happens on connect

🖥️

Our servers

IIS, SQL, Java, PHP, errors and bad habits

Part 1 · Crypto basics

Symmetric encryption: one shared key

🔐

Like a safe with a combination

The same key locks and unlocks. Fast enough to encrypt everything: web pages, SQL queries, file transfers. (AES)

📨

The problem

How do we agree on the combination? If I email it to you, anyone reading the email has it too.

Part 1 · Crypto basics

A key pair: hand out padlocks, keep the key

🔓

Public key

An open padlock. Give it to anyone. If it leaks, nothing bad happens.

🗝️

Private key

The only key that opens that padlock. Never leaves the server. If it leaks, anyone can pretend to be you.

The private key is the crown jewel. 👑

Part 1 · Crypto basics

A key pair does two jobs

JobHowProves
EncryptAnyone locks with your public key. Only your private key unlocks.Only you can read it
SignYou sign with your private key. Anyone checks with your public key.It came from you and wasn’t changed

Signing is a wax seal 🕯️ Anyone can check it. Only you can make it. Certificates run on signing.

One does not simply

🧙‍♂️

email the .pfx

Part 1 · Crypto basics

Hashes: a fingerprint for data

SHA-256("hello") = 2cf24dba5fb0a30e26e83b2ac5b9e29e… SHA-256("hello!") = ce06092fb948d9ffac7d1a376e404b26…

Same in, same out

Every time, on every machine.

Tiny change, totally different

One character flips the whole hash.

One way

You can’t get the data back from it.

You’ve seen these as cert thumbprints in IIS. Avoid MD5 and SHA-1.

Part 2 · Certificates

A certificate is an ID card for a public key

FieldExample
Subject Alternative Namesapp.rrc.qld.gov.au, app01.rrc.local ← the names it’s valid for
IssuerThe CA that signed it
Valid from / to2026-03-01 → 2026-09-17
Public keyRSA 2048 / ECDSA P-256
SignatureThe issuer’s seal over all of the above

Not in it: the private key. That lives separately on the server.

🧑‍💻☕

Browsers ignore the CN.
Only the SAN counts.

Change my mind.

Part 2 · Certificates

The chain of trust

🏛️

Root CA

Self-signed. Offline. ~20 years. Pre-installed in your trust store.

→
🏢

Intermediate CA

Does the day-to-day signing.

→
🖥️

Your server cert

On IIS, Apache, SQL…

The server must send its cert + the intermediate. The client already has the root.

😎

Chrome: “Missing intermediate? I’ll just go fetch it.”

😭

Java, PHP, curl: PKIX path building failed

“It works in Chrome” proves nothing.

Part 2 · Certificates

Public CA or internal CA?

Public CAInternal CA
ExamplesDigiCert, Sectigo, Let’s Encrypt[Our internal CA]
Trusted byEvery device in the worldOnly our domain-joined machines
NamesReal public domains we ownAnything, incl. rrc.local
Use forPublic, phones, vendors, SaaSInternal sites, server-to-server, SQL, LDAPS

If anything outside our domain-joined fleet must trust it, it needs a public cert.

Part 3 · TLS

TLS gives you three things

🙈

Confidentiality

Nobody in between can read it.

🧾

Integrity

Nobody can change it unnoticed.

🪪

Authentication

You’re talking to the real server.

Under HTTPS, SQL Server, LDAPS, SMTP, RDP, WinRM, APIs and most SaaS integrations. “SSL” is just the old name.

Part 3 · TLS

What happens when a client connects

1
Client → Server

“Hello. I speak TLS 1.3 / 1.2. I want app.rrc.qld.gov.au.”

2
Server → Client

“Here’s my cert + intermediate, and proof I hold the private key.”

3
Client

Checks name, dates, chain, revocation. Any fail = stop.

4
Both

Agree a session key without ever sending it (ECDHE).

5
Both

Everything else is fast symmetric encryption. 🔒

Part 3 · TLS

Every cert error is one of four checks

🏷️

Name

Is the name I used in the SAN? Not by IP, short name or alias.

📅

Dates

Not expired? Is the server clock right?

⛓️

Chain

Leads to a root I trust? Intermediate sent?

🚫

Revocation

Not cancelled? Can I reach the CRL/OCSP URL?

Work out which one failed. The fix is usually obvious.

Renew the cert now
Wait, it’s not due till Saturday
😰

Every sysadmin, every renewal cycle

Part 4 · Our servers

Where you’ll meet certificates

PlatformCert lives inWatch out for
IIScertlm.msc → Personal; site BindingsKey icon present; SNI if sites share an IP
SQL ServerWindows store, picked in SQL Config ManagerService account needs key access; new drivers validate by default
Apache / nginx / PHPPEM files: cert, chain, keyUse the full-chain file; lock down the key
JavaKeystores + its own cacertsIgnores the Windows trust store
Firewall / LBTheir own storesTLS inspection re-signs outbound traffic [confirm]

Part 4 · Our servers

File formats: one rule

✅ Public, share freely

.cer .crt .p7b .csr

🛑 Contains a private key

.pfx .p12 .key (and some .pem)

If it has a private key in it, it’s a password.

Don’t email it, share it, commit it or ticket it. Best of all: generate the CSR on the server so the key never travels.

🙅
TrustServerCertificate=True
😏👉
Put a proper internal-CA cert on the SQL Server

Part 4 · Our servers

Error decoder

You seeUsually means
ERR_CERT_DATE_INVALID📅 Expired (or clock wrong)
ERR_CERT_COMMON_NAME_INVALID🏷️ Name not in SAN
ERR_CERT_AUTHORITY_INVALID⛓️ Self-signed / untrusted CA / no intermediate
unable to get local issuer certificate⛓️ Missing intermediate or CA not in app’s bundle
PKIX path building failed (Java)⛓️ Same, import CA into cacerts
SQL: authority that is not trusted⛓️ Self-signed SQL cert, new driver validates

Part 5 · Lifecycle

Public cert lifetimes are shrinking

From 15 Mar 2026

200

days max

From 15 Mar 2027

100

days max

From 15 Mar 2029

47

days max

Manual renewal stops being practical. We’re moving to automated issuance (ACME) and an accurate cert inventory.

Click through the browser warning
🧠
Set verify=False and move on
🧠
Install the cert with the full chain
🧠
Automate renewal and never think about it again
🌌

Part 5 · Try it

Check your own servers

# Certs expiring in the next 60 days Get-ChildItem Cert:\LocalMachine\My | Where-Object { $_.NotAfter -lt (Get-Date).AddDays(60) } | Select-Object Subject, NotAfter, Thumbprint, HasPrivateKey # What does a server actually send? openssl s_client -connect app.rrc.qld.gov.au:443 \ -servername app.rrc.qld.gov.au -showcerts </dev/null

Or click the padlock → Certificate → Certification Path.

Recap

Five things to remember

1

Public key is public. Private key is a secret, and so is any .pfx or .key.

2

A cert is an ID card for a public key, signed by a CA we trust.

3

TLS uses certs to prove identity and agree a key, then encrypts fast.

4

Every error is name, date, chain or revocation.

5

Never fix a cert error by turning checking off.

Questions?

Notes and quiz: elearn.ziggi.dev/pki-tls

Cert requests: [process] · TLS questions: [contact]

← → space · N notes · F fullscreen
Read notes page