Explore our new Cybersecurity Terms Glossary, explained by our experts.
Cybersecurity Terms Glossary
Certificate pinning tells an app to accept only one specific certificate or public key for a server, so a valid-looking certificate from any other authority is rejected outright.

What Is Certificate Pinning?
Certificate pinning narrows trust. Instead of accepting any certificate that chains to one of the hundred or so authorities in the device trust store, a pinned app accepts only the specific certificate, or the specific public key, that you told it to expect. Everything else fails the handshake, even if it is technically valid.
The reason is simple arithmetic. Standard TLS validation trusts every certificate authority in the store equally, so any one of them—compromised, coerced, or merely careless—can issue a certificate for your domain. DigiNotar proved the point in 2011, when fraudulent certificates for Google domains were used against Iranian users and the authority was removed from every major trust store within weeks.
Three options exist, and the choice has real operational consequences.
On Android, the platform supports this declaratively through the network security configuration, with no custom trust manager to get wrong:
<domain-config>
<domain includeSubdomains="true">api.example.co.uk</domain>
<pin-set expiration="2027-06-30">
<pin digest="SHA-256">primary-key-hash=</pin>
<pin digest="SHA-256">backup-key-hash=</pin>
</pin-set>
</domain-config>
OkHttp’s CertificatePinner offers the same thing in code. On iOS, App Transport Security handles ordinary validation, and pinning is added in a URLSession delegate or through a library such as TrustKit; since iOS 14 Apple also supports pinning declaratively in the app’s Info.plist.
Pinning is the one security control that can take your service offline without any attacker involved. If the pinned key is replaced and users have not updated the app, every request fails, and the only fix is a release that must pass store review while customers are locked out. The discipline that prevents this is unglamorous: always ship at least one backup pin for a key you hold offline, set an expiry on the pin set so it degrades to normal validation instead of hard-failing, and keep the renewal in the same change calendar as your certificate expiry.
The web equivalent, HTTP Public Key Pinning, failed for exactly this reason. Sites locked themselves out, and Chrome removed support in version 72 in January 2019. Certificate Transparency monitoring replaced it: rather than refusing unexpected certificates, you detect them in public logs and act. Mobile apps kept pinning because they ship their own trust decisions and can be updated as a unit.
Pinning defeats the casual interception path—a proxy with a user-installed root CA—and that alone is worth having, because Android has not trusted user-added certificates for app traffic by default since Android 7. On a rooted or jailbroken device, though, pinning is a speed bump. Frida and objection hook the validation routine at runtime; an APK can be repackaged with the pin set removed; on iOS, SSL Kill Switch patches the trust evaluation. Testers rely on exactly these techniques, which is why a pentest report that says “pinning bypassed” is a statement about the device, not a failure of the control.
Treat pinning as protection for ordinary users on ordinary devices, and layer it with root and jailbreak detection plus server-side attestation when the risk justifies it.
No UK regulation names pinning explicitly, but it turns up repeatedly in assessments of apps that handle money or health data. Open Banking implementations, PCI DSS scoped payment apps, and OWASP MASVS-NETWORK-2 all expect the app to constrain which certificates it will accept rather than relying on the device trust store. If your organisation runs its own inspection proxy, note the tension: pinning in a corporate app will break that inspection, so the exception has to be designed in rather than discovered.
Our Mobile Application Security Services verify pinning implementations end to end, including how your app behaves when a pin no longer matches.
No. Pinning suits apps where interception has a direct financial or safety consequence—banking, payments, health, messaging. For a content app with no sensitive data, the operational risk of a locked-out user base outweighs the benefit. Decide from the data the app carries, and if you pin, commit to the rotation process rather than treating it as a one-off configuration change.
A certificate pin matches the whole certificate, so it breaks on every renewal, even a routine one. A public key pin matches a hash of the Subject Public Key Info, so a certificate reissued with the same key pair still validates. Public key pinning is the usual recommendation because it survives renewals while still restricting trust to keys you control.
Yes, and deliberately so. An inspection proxy presents a certificate issued by the organisation’s own authority, which a pinned app will reject. Enterprises normally exclude pinned applications from inspection by domain, or ship an internally built variant with the inspection CA pinned alongside the production key. Plan this before deployment, not after the helpdesk tickets arrive.
On a rooted or jailbroken test device, they hook the validation code at runtime with Frida or objection, repackage the app with the pin set removed, or patch the platform trust evaluation. These require control of the device, which an attacker targeting a single ordinary user usually does not have. Pinning raises cost without being absolute.
You May Be Interested In These
We use a few cookies that are needed to make this website work, and they are always on. We would also like to set analytics cookies, to see which pages are useful; functional cookies, so that our live chat works; and advertising cookies, to measure our campaigns. We will not set any of those until you say yes, and you can change your mind at any time from the Cookie Settings link in the footer.
Choose the cookies you are happy for us to use. Strictly necessary cookies are always on; everything else is off until you turn it on.
These cookies keep the website working: they hold your security checks, your form submissions and the choice you make here. The site cannot run without them, so they are always on.
These let our live chat open and remember your conversation, and let the newsletter sign-up work. Switch them off and the chat window will not appear.
These tell us which pages are read and how people find us, so that we can improve the site. The reports are about groups of visitors, never about you personally.
These let us measure our advertising and show you our adverts on other websites, such as LinkedIn, Google and Meta. Switch them off and you will still see adverts, but they will be less relevant.