Skip to content

Instantly share code, notes, and snippets.

View yasodha-r's full-sized avatar

Yas yasodha-r

View GitHub Profile
@sye8
sye8 / swift3SelfSignedSSLCert.md
Last active March 26, 2024 18:45
Swift 3 Trusting a Self-Signed SSL Certificate

Swift 3 Trusting a Self-Signed SSL Certificate

For testing purposes, we may want to have local testing servers using self-signed SSL certificate for HTTPS connection. Now, suppose we have a local server with self-signed certificate, establishing an actual HTTPS connection would require us to trust our self-signed certificate. It is easy on a browser: few clicks, and you will be on your way. But how about a Swift application?

Caution: Get an actual, trusted, signed certicate for production apps!

0. A regular HTTPS request

App Transport Security (ATS) is a technology that requires an app to either support best practice HTTPS security or statically declare its security limitations via a property in its Info.plist.