Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

stevenlee's avatar

How to implement Let's encrypt Certificate pinning on iOS app when the certificate is expired and renewed every three months?

I am trying to implement certificate pinning on our iOS app to prevent sniffing by tools (Charles proxy, mitmproxy, etc) when connecting to our REST api with Let's encrypt certificate.

On Alamofire, I setup serverTrustPolicy to pinCertificate for our domain. Once this is done, Charles proxy can no longer listen in because the connections are rejected. Great. But the problem is that the certificate has to be embedded in the app bundle and it will brick the app once the certificate is renewed.

How should I handle this?

Can we renew Let's encrypt certificate without changing the public key? Does anyone have experience in handling this situation?

0 likes
0 replies

Please or to participate in this conversation.