What's the best practice for storing a certificate for use by an iOS app?

I am developing an iOS app which will connect to a server via websocket. Authentication requires me to sign a token using a .pem file.


My question is, what's the "correct" way to store my certificate securely? I can put it in the bundle, or serialize it and include it in the source code, but is this the best way? Is there an official designated way to deal securely with certificates and keys on iOS?

Replies

If I understand your objective, you might consider storing the cert in the keychain - see https://developer.apple.com/documentation/security/certificate_key_and_trust_services/certificates/storing_a_certificate_in_the_keychain