What is Certificate Pinning?
A security technique where an application trusts only a specific, pre-selected certificate or public key for a given server, bypassing the standard chain of trust.
Certificate pinning is a mechanism that binds a host to an expected X.509 certificate or public key. Instead of relying solely on the certificate authority (CA) system, a client application (such as a mobile app or a browser extension) is hard-coded to accept only a particular certificate fingerprint or public key hash for a given domain. If the server presents any other certificate, even one issued by a trusted CA, the connection is rejected.
The technique became widely used to defend against attacks where a rogue CA issued a fraudulent certificate for a high-value domain. For HTTP, a standard called HTTP Public Key Pinning (HPKP) was introduced via RFC 7469 (2015). HPKP allowed servers to instruct browsers to pin their public key for a defined period. However, HPKP proved dangerous. A misconfiguration could pin a site to the wrong key, causing a denial of service that lasted until the pin expired. This led to HPKP being deprecated and removed from major browsers by 2018. The attack surface shifted when CA-issued certificates became more trustworthy with Certificate Transparency (RFC 6962).
Today, certificate pinning survives primarily in mobile applications, especially on Android and iOS. These apps embed pins for their own API endpoints. The mobile approach avoids the catastrophic failure mode of HPKP because the pin set can be updated with the app itself, though it still requires careful lifecycle management. The practice is not recommended for public websites or APIs where the client cannot be controlled, but it remains a valid hardening step for closed ecosystems, banking apps, and enterprise device management.
Key facts
- Bypasses the global CA trust store in favor of a single, pre-approved certificate.
- HPKP (RFC 7469) was deprecated after 3 years due to risk of permanent denial of service.
- Mobile apps remain the primary use case due to controllable client updates.
- Pins can be a hash of the full certificate, a public key, or a subject public key info (SPKI).
- Certificate Transparency reduces the need for pinning on public HTTPS sites.
How it works in practice
Related terms
References
More in TLS & PKI
ACME Protocol
ACME (Automated Certificate Management Environment) is a protocol that automates the issuance, renewal, and revocation of TLS certificates, defined in RFC 8555.
Certificate Authority
A Certificate Authority (CA) is a trusted entity that issues digital certificates after verifying that the requester controls the domain or identity named in the certificate.
Certificate Chain
A certificate chain is an ordered list of certificates, starting with the server certificate and ending with a root CA, that a client validates to establish trust in the server's identity.
Cipher Suite
A cipher suite is a named set of cryptographic algorithms negotiated during a TLS handshake, specifying key exchange, authentication, encryption, and integrity protection for secure communications.
Domain Validation
Domain Validation (DV) is the lowest level of certificate validation used in TLS/SSL, where the certificate authority verifies only that the applicant controls the domain name, typically via an HTTP or DNS challenge.
ECH
Encrypted Client Hello (ECH) is a TLS extension that encrypts the Client Hello message, including the Server Name Indication (SNI), to prevent on-path observers from learning the target hostname during the handshake.
Extended Validation
Extended Validation (EV) is the highest level of TLS certificate assurance, requiring the certificate authority to perform rigorous, human-verified checks on the legal identity and operational existence of the requesting organization before issuance.
HSTS
HTTP Strict Transport Security (HSTS) is a web security policy mechanism that forces browsers to interact with a website only over HTTPS, preventing downgrade attacks and cookie hijacking.
Intermediate Certificate
An intermediate certificate is a subordinate CA certificate signed by a root CA, used to sign end-entity certificates and enable path validation while the root remains offline.
Let's Encrypt
Let's Encrypt is a free, automated, public certificate authority operated by the Internet Security Research Group (ISRG) that issues short-lived Domain Validation (DV) TLS certificates via the ACME protocol.