swiftssl-certificatealamofiresslpinning

iOS Alamofire SSL Pinning with both certificate about to expire and a new certificate


My application implements SSLPining with leaf certificate. And it's about to expire.
I researched and got the answer:

Some time before the certificate expires, release a new version of your app with a replacement cert in the pin list, as well as the original cert

How can i add both replacement cert and original cert to my project?
I just need to add a new certificate with any name and Will Alamofire go through all the certificate files I declare and if any match will it allow the connection? Thanks


Solution

  • Yes, that will work. Alamofire's PinnedCertificatesTrustEvaluator gathers all certificates from the main bundle by default and checks to see whether the certificate received is within that set. So as long as both certificates are within that set, either of them should work.