iOS9 PayPal SDK - “An SSL error has occurred…”

和自甴很熟 提交于 2019-12-24 00:54:28

问题


I'm getting the same error as reported in this question iOS9 getting error “an ssl error has occurred and a secure connection to the server cannot be made”

I've checked with SSL labs using the PayPal URL https://mobileclient.paypal.com and it tells me that the it only supports the following ciphers...

TLS_RSA_WITH_RC4_128_SHA
TLS_RSA_WITH_RC4_128_MD5
TLS_RSA_WITH_AES_256_CBC_SHA
TLS_RSA_WITH_AES_128_CBC_SHA
TLS_RSA_WITH_3DES_EDE_CBC_SHA

Which don't match exactly the ciphers listed in the Apple Documentation https://developer.apple.com/library/prerelease/ios/technotes/App-Transport-Security-Technote/

I wanted to ask is it the fact the ciphers aren't exactly the same the issue? I certainly don't want to bypass ATS as far as PayPal is concerned, do I?


回答1:


I read the documentation further which is what I should of done before asking the question! But to allow the ciphers that are listed I need to turn off NSExceptionRequireForwardSecrecy for that URL, from the docs...

NSExceptionRequiresForwardSecrecy A Boolean value for overriding the requirement that the domain support forward secrecy using ciphers.

YES is the default value and limits the ciphers to those shown in Default Behavior.

Setting the value to NO adds the following the list of accepted ciphers:

  • TLS_RSA_WITH_AES_256_GCM_SHA384
  • TLS_RSA_WITH_AES_128_GCM_SHA256
  • TLS_RSA_WITH_AES_256_CBC_SHA256
  • TLS_RSA_WITH_AES_256_CBC_SHA
  • TLS_RSA_WITH_AES_128_CBC_SHA256
  • TLS_RSA_WITH_AES_128_CBC_SHA



回答2:


As Flexicoder wrote you have to disable NSExceptionRequiresForwardSecrecy.
Add this to your Info.plist

<key>NSAppTransportSecurity</key>
    <dict>
        <key>NSExceptionDomains</key>
        <dict>
            <key>yourDomain.com</key>
            <dict>
                <key>NSExceptionRequiresForwardSecrecy</key>
                <false/>
            </dict>
        </dict>
    </dict>


来源:https://stackoverflow.com/questions/32869268/ios9-paypal-sdk-an-ssl-error-has-occurred

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!