Strengthen your mobile application security with certificate pinning.
SSL Pinning (or Certificate Pinning) is a security technique that associates a mobile application with a specific SSL certificate or its public key. This prevents man-in-the-middle attacks even if the attacker has a valid certificate issued by a trusted certificate authority.
Without pinning, an application trusts any certificate signed by a CA in the system trust store. With pinning, the application only trusts the certificate or public key you have specifically configured.
MoniTao helps you monitor your certificates and alerts you when they change, which is crucial if you use SSL Pinning because you'll need to update your applications during renewals.
Understanding the concept of certificate pinning:
Different pinning approaches:
Steps to implement pinning:
Code for different platforms:
# Extract SPKI hash from a certificate
openssl s_client -connect api.mysite.com:443 2>/dev/null | \
openssl x509 -pubkey -noout | \
openssl pkey -pubin -outform DER | \
openssl dgst -sha256 -binary | base64
# Result: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
# Android (network_security_config.xml)
<network-security-config>
<domain-config>
<domain includeSubdomains="true">api.mysite.com</domain>
<pin-set expiration="2025-01-01">
<pin digest="SHA-256">AAAA...=</pin>
<pin digest="SHA-256">BBBB...=</pin> <!-- backup -->
</pin-set>
</domain-config>
</network-security-config>
The SPKI hash is added to the application's network security configuration. Always include a backup pin.
Tips for successful SSL Pinning:
No, but it's strongly recommended for applications handling sensitive data (banking, health, etc.).
The application will refuse to connect to your server. This is why backup pins are essential.
Let's Encrypt renews certificates often. Pin the public key and keep the same key during renewals, or pin the intermediate certificate.
It's complex because CDNs can have multiple certificates. Consult your CDN's documentation.
Use Charles Proxy or Wireshark to capture traffic and check which certificate is presented.
MoniTao monitors your certificates and alerts you before expiration, giving you time to prepare new pins.
SSL Pinning is an essential security layer for mobile applications handling sensitive data. Well implemented, it protects against even sophisticated MITM attacks.
With MoniTao, monitor your certificates and anticipate renewals to maintain a smooth user experience while keeping optimal security.
Start free, no credit card required.