Cybersecurity glossary

What is Certificate Pinning?

Learn what certificate pinning is, why SPKI pinning replaced brittle certificate pins, why HPKP was deprecated, and when pinning makes sense compared with Certificate Transparency.

Cryptography and TLSUpdated August 11, 2026
Also known asPublic key pinningTLS pinningSPKI pinningHTTP Public Key PinningHPKP

Definition

Certificate pinning is a client-side TLS control that restricts which certificate, public key, or issuing key material a client will accept for a service, reducing reliance on the full public CA ecosystem but adding serious operational risk if pins are wrong or cannot rotate.

Why certificate pinning is tempting

TLS normally trusts any certificate chain that validates to a trusted root and matches the requested name. That scales the web, but it also means many public Certificate Authorities can issue for the same domain if validation succeeds or fails in their systems.

Certificate pinning narrows that trust decision for a specific client. Instead of accepting every valid Web PKI certificate for api.example.com, the client also checks whether the presented key material matches a known pin.

That extra check can help high-risk apps, but it moves certificate lifecycle risk into the application.

What can be pinned

Modern guidance favors pinning stable public-key material rather than entire leaf certificates.

Leaf certificate pin

Pins one exact certificate. Simple to reason about, but every renewal or reissue can break clients.

SPKI pin

Pins a hash of SubjectPublicKeyInfo, letting a renewed certificate keep working if the key stays the same.

Intermediate CA pin

Pins an issuing CA key to allow routine leaf changes while rejecting unexpected issuers.

Private trust anchor

Pins or ships an internal root for controlled clients such as enterprise apps, devices, or service agents.

SPKI pinning is common because the pin is calculated over the certificate's public-key structure, not over expiration dates, SAN lists, or signatures. It still requires planning: if you lose the matching private key, clients need a trusted path to a replacement key.

How SPKI pin validation works

Pinning should be an additional validation step, not a replacement for normal TLS checks.

1

Build a valid TLS connection

The client first performs standard certificate chain, hostname, validity, and policy checks.

2

Extract public-key material

From the leaf or selected issuer certificate, the client reads the SubjectPublicKeyInfo bytes.

3

Hash the SPKI

A pinned digest, commonly SHA-256 over SPKI, is compared with the local pin set.

4

Require a pin match

If no allowed primary or backup pin matches, the client fails closed for that service.

5

Rotate deliberately

New keys are introduced through app releases, remote configuration, or previously shipped backup pins before production cutover.

The order matters. A raw key match should not make an expired, wrong-name, or otherwise invalid certificate acceptable unless you are building a deliberately private trust model with explicit rules.

HPKP, mobile pinning, and CT compared

ControlCurrent statusBest fit
HPKP headerDeprecated and removed from major browsersHistorical knowledge; avoid for new web deployments
Mobile or app SPKI pinningStill used selectivelyControlled clients facing targeted MITM or hostile local trust-store risk
Certificate TransparencyBaseline for public TLS certificatesDetecting public CA mis-issuance and monitoring domain inventory
Expect-CTObsolete transitional headerLegacy cleanup and scanner context, not new protection
Private PKI or mTLS trust anchorsActive enterprise patternService-to-service, device, and partner ecosystems under operator control

HTTP Public Key Pinning (HPKP), defined in RFC 7469, let servers send a Public-Key-Pins header that browsers cached. It was powerful enough to be dangerous: a mistaken max-age, missing backup pin, lost key, compromised server, or hostile pin could make a site unreachable for affected users. Browser vendors removed it rather than keep a web-scale footgun.

Mobile and thick-client pinning survived because the application publisher controls the client code. That control is also the main risk: if the app has no update path, no backup pins, or no tested emergency process, a normal CA rotation can become a production incident.

Deployment checklist

  • Use pinning only for a clear threat model, such as high-value mobile APIs, managed devices, or private service clients.
  • Prefer SPKI hashes over whole leaf certificate pins for public TLS endpoints.
  • Keep normal TLS validation enabled before applying pin checks.
  • Ship at least one tested backup pin whose private key is protected and available for emergency rotation.
  • Document rotation steps for CDN, CA, key, and app-release changes before enabling enforcement.
  • Add telemetry that distinguishes pin failures from generic TLS errors without leaking secrets.
  • Avoid HPKP and remove obsolete `Public-Key-Pins` headers from browser-facing sites.
  • Use Certificate Transparency monitoring for public domains; pinning does not tell you what other certificates were issued.

When pinning is worth it

Certificate pinning can make sense when both sides of the channel are under one organization's control and the client population can be updated quickly. Examples include a banking mobile app, managed endpoint agent, embedded device, or internal service client that talks to a small set of APIs.

It is usually a poor fit for ordinary public websites. Browsers already enforce Web PKI rules, public certificates are covered by CT expectations, and users cannot recover easily from site operator pinning mistakes. For the public web, prioritize automated certificate renewal, strong CA account security, HSTS, CT monitoring, and incident response for unexpected issuance.

Expect-CT belongs in the history section of this decision. It was useful while browsers were transitioning toward CT enforcement, but new systems should not choose between Expect-CT and pinning. They should choose between broad public-issuance visibility through CT monitoring and narrow client-side trust restriction through app-controlled pinning.

The practical takeaway

Certificate pinning narrows TLS trust by requiring known certificate or public-key material, with SPKI pinning being the least brittle common form. It can reduce exposure to CA mis-issuance and local trust-store abuse for controlled clients.

Use it sparingly, keep backup pins ready, and rehearse key rotation. For normal web properties, avoid HPKP and rely on CT-compliant certificates plus continuous Certificate Transparency monitoring instead.

Related security terms

Frequently asked questions

What is certificate pinning in simple terms?

Certificate pinning means an app or client accepts only specific TLS key material for a service instead of trusting any valid certificate from the normal public CA ecosystem.

What is SPKI pinning?

SPKI pinning stores a hash of the certificate's SubjectPublicKeyInfo, which represents the public key and algorithm. It is usually less brittle than pinning an entire leaf certificate because a certificate can be reissued around the same key.

Why was HPKP deprecated?

HTTP Public Key Pinning let websites tell browsers to remember pins, but misconfiguration could lock users out for long periods and attackers could abuse hostile pins. Major browsers removed support, so HPKP should not be used for new web deployments.

Should mobile apps use certificate pinning?

Only when the threat model justifies the operational cost. Mobile pinning can reduce CA mis-issuance and local trust-store abuse, but a bad pin or rushed certificate rotation can break installed apps until users update.

What are backup pins?

Backup pins are hashes for keys that are not serving traffic yet but can be deployed during rotation or incident response. Without tested backup pins, pinning can turn normal certificate replacement into an outage.

Does certificate pinning replace Certificate Transparency?

No. Pinning controls what a specific client accepts; Certificate Transparency makes public certificate issuance visible. Internet-facing sites usually need CT-compliant certificates and monitoring even if a controlled app also pins keys.

Is Expect-CT the same as certificate pinning?

No. Expect-CT was a now-obsolete browser header for CT enforcement and reporting. It did not pin a service to specific keys, and modern browsers largely enforce CT through built-in policy instead.

References

Explore authoritative guidance and frameworks related to certificate pinning.

Explore every security definition

Return to the glossary to search by term, alias, starting letter, or security category.

Browse glossary