onmyway133 / blog

🍁 What you don't know is what you haven't learned
https://onmyway133.com/
MIT License
669 stars 33 forks source link

How to use native SSL Pinning #880

Open onmyway133 opened 2 years ago

onmyway133 commented 2 years ago

From iOS 14, we can do Identity Pinning: How to configure server certificates for your app right from Info.plist

<key>NSAppTransportSecurity</key>
    <dict>
        <key>NSPinnedDomains</key>
        <dict>
            <key>awesome.apps.example.com</key>
            <dict>
                <key>NSIncludesSubdomains</key>
                <true/>
                <key>NSPinnedCAIdentities</key>
                <array>
                    <dict>
                        <key>SPKI-SHA256-BASE64</key>
                        <string>12312312312xasdas123asdasdasdasdsad</string>
                    </dict>
                </array>
            </dict>
        </dict>
    </dict>

There are a few drawbacks

Read more