SSL Pinning with AFNetworking

前端 未结 3 2094
[愿得一人]
[愿得一人] 2020-12-23 15:08

In my app I\'m using https and a self-signed SSL certificate to secure the connection between my client and the server.

I was trying to have the AFNetworking library

3条回答
  •  無奈伤痛
    2020-12-23 16:05

    If you're using AFNetworking 2.x, and you're using the correct .cer but still receiving error code -1012 on your calls, you should disable validatesCertificateChain:

    AFSecurityPolicy *securityPolicy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModePublicKey];
    securityPolicy.validatesCertificateChain = NO;
    

    or you can pass it all in the entire certificate chain in pinnedCertificates.

提交回复
热议问题