ios - How to compare SSL certificates using AFNetworking -
in iphone app i'm using https
connection self-signed ssl
certificate download sensible data (username , password) server.
this app private use only, not meant production.
i'm using afnetworking
manage https
connection but, since certificate isn't signed ca, in order make work had add following header of afurlconnectionoperation
class:
#define _afnetworking_allow_invalid_ssl_certificates_ 1
but app allow certificate.
is there way allow certificate server maybe bundling in app , comparing certificate provided server in https connection? , if possible, there significant advantage in terms of security?
i'm new security , i'm kind of confused.
the term you're looking ssl pinning, app verifies known certificate or public key matches 1 presented remote server.
afnetworking supports both pinning certificates or public keys. you'll need add certificate(s) or public key(s) app's bundle, , enable feature setting either defaultsslpinningmode
property on afhttpclient or sslpinningmode
property on afurlconnectionoperation
.
you can pin using afsslpinningmodepublickey
or afsslpinningmodecertificate
. afsslpinningmodecertificate
means server's certificate must match 1 of in bundle.
afsslpinningmodepublickey
more liberal , means server's certificate must match public key in bundle, or public key attached certificates in bundle.
there's example of setting pinning mode in appdotnet example.
Comments
Post a Comment