Scrapeless Wiki

What Is Certificate Pinning? – Definition and How It Works

Informational P3 what is certificate pinning

Learn what certificate pinning is, how it blocks TLS interception, and why it matters for mobile API traffic analysis.

Certificate pinning makes a client accept only specific certificates or public keys for a given host, instead of any certificate signed by a trusted authority. It narrows trust from "any CA" to "this key".

1. What Problem It Solves

Normal TLS validation trusts any certificate chaining to a trusted root. That means hundreds of certificate authorities β€” and anyone who can add a root to the client's trust store β€” can produce a certificate the client accepts.

Pinning removes that: the client checks the server's certificate or public key against a value baked into the application, so a validly signed certificate from any other source is rejected.

2. What Gets Pinned

Pinned value Trade-off
Leaf certificate Strictest; breaks on every renewal
Leaf public key Survives renewal if the key is reused
Intermediate certificate Survives leaf changes, trusts one CA path
CA certificate Loosest form of pinning

Public-key pinning is the usual choice, because a certificate can be renewed with the same key pair and the pin still validates.

3. Where It Is Used

Mobile applications, especially banking, payments, and messaging β€” the dominant real-world use.

Machine-to-machine APIs with a known, fixed peer.

Embedded devices talking to a single vendor endpoint.

It is largely absent from websites: browser-based HTTP public key pinning was deprecated and removed, because a wrong pin bricked a site with no recovery path.

4. Why It Matters for Traffic Analysis

Understanding a mobile application's API normally means intercepting its HTTPS traffic with a local proxy whose root certificate you add to the device's trust store. That works because ordinary validation trusts any trusted root.

Pinning defeats it. The application compares against its embedded pin, sees a different key, and refuses to connect β€” typically with a generic network error rather than a TLS message, which makes it look like the API is down.

The practical consequence: a pinned application's traffic cannot be inspected by adding a certificate, and the observable symptom is a connection failure with no useful diagnostic.

5. Recognising It

  • Traffic works without a proxy, and fails immediately with one.
  • The failure is instant, at handshake time, not after a request.
  • The error is generic β€” "network error", "could not connect".
  • A browser reaches the same API endpoint fine while the app does not.
  • Other apps proxy normally on the same device.

That last check is the useful one: it isolates pinning in the application from a misconfigured proxy or trust store.

6. The Operational Risk

Pinning's own failure mode is severe. If a pinned certificate expires or a key rotates and deployed clients hold the old pin, every one of them stops working β€” and they cannot be fixed remotely, because the channel used to update them is the channel that is broken.

Mitigations are standard practice: pin several keys including a backup not yet in use, set a pin lifetime rather than pinning forever, and provide a fallback path. Their existence tells you how easily pinning causes outages.

7. Certificate Transparency as the Alternative

Rather than pinning, most web deployments rely on Certificate Transparency: every publicly trusted certificate is logged, and a domain owner monitors the logs for certificates issued for their names.

This detects misissuance without the outage risk, which is why it, rather than pinning, is where the web went.

8. Summary

Certificate pinning restricts a client to specific certificates or public keys instead of trusting any certificate authority, and it is standard in mobile and machine-to-machine clients rather than on the web.

For traffic analysis it means a pinned application's HTTPS cannot be inspected by installing a proxy root β€” the symptom is an immediate, generic connection failure β€” and for operators it carries a real outage risk, which is why the web relies on Certificate Transparency instead.