tls-pinning
Installation
SKILL.md
TLS Certificate Pinning
Instructions
Certificate pinning raises the cost of an active MITM with a user-trusted CA. Done wrong, it bricks your app. Done right, it's a small, durable control.
1. Pin Subject Public Key Info (SPKI), Not Certificates
Pinning a full certificate breaks every time the cert is rotated (typically yearly). Pin the SPKI SHA-256 of the leaf or of an intermediate / root you control. SPKI survives cert renewal as long as the key does.
Generate a pin:
openssl s_client -servername api.example.com -connect api.example.com:443 \
</dev/null 2>/dev/null | openssl x509 -pubkey -noout \
| openssl pkey -pubin -outform DER \
| openssl dgst -sha256 -binary \
| base64