关于iOS9中的App Transport Security相关说明及适配(更新于2016.7.1)

摘要

为解决在iOS9下基于ATS对HTTP的请求的说明及适配进行说明

2016.7.1根据苹果官方文档的修改做出文档的调整,并加入对诊断ATS的命令行工具nscurl进行说明。

2015.8.19解决在iOS9下基于ATS对HTTP的请求的说明及适配进行说明

iOS9中新增App Transport Security(简称ATS)特性, 主要使到原来请求的时候用到的HTTP,都转向TLS1.2协议进行传输。这也意味着所有的HTTP协议都强制使用了HTTPS协议进行传输。原文如下:

App Transport Security

App Transport Security

(ATS) enforces best practices in the secure connections between an app

and its back end. ATS prevents accidental disclosure, provides secure

default behavior, and is easy to adopt; it is also on by default in iOS 9

and OS X v10.11. You should adopt ATS as soon as possible, regardless

of whether you’re creating a new app or updating an existing one.

If you’re developing a new app, you should use HTTPS exclusively. If you have an existing app, you should use HTTPS as much as you can right now, and create a plan for migrating the rest of your app as soon as possible. In addition, your communication through higher-level APIs needs to be encrypted using TLS version 1.2 with forward secrecy. If you try to make a connection that doesn't follow this requirement, an error is thrown. If your app needs to make a request to an insecure domain, you have to specify this domain in your app'sInfo.plistfile

如果我们在iOS9下直接进行HTTP请求是会收到如下错误提示:

App Transport Security has blocked a cleartext HTTP (http://)

resource load since it is insecure. Temporary exceptions can be

configured via your app's Info.plist file.

系统会告诉我们不能直接使用HTTP进行请求,需要在Info.plist新增一段用于控制ATS的配置:

NSAppTransportSecurityNSAllowsArbitraryLoads

也即:

这段配置中的NSAppTransportSecurity是ATS配置的根节点,配置了节点表示告诉系统要走自定义的ATS设置。而NSAllowsAritraryLoads节点则是控制是否禁用ATS特性,设置YES就是禁用ATS功能。

ATS

是在iOS 9.0 和 OS X v10.11版本中增加的特性,使用iOS 9.0或者OS X

v10.11的SDK版本(或更新的SDK)进行编译应用时会默认启动ATS。则需要对ATS进行配置。如果使用iOS 9.0或者OS X

v10.11之前的SDK版本编译的应用默认是禁止ATS的,因此不会影响应用的网络连接方面的功能(即使在iOS 9.0的机子上跑也是不影响的)。

直到前面的配置可以完美的适配iOS9了,但是如果你想遵循苹果给出的标准,让自己的数据更加安全,那么需要继续往下看。

其实ATS并不单单针对HTTP进行了限制,对HTTPS也有一定的要求,以百度的地址为例(注:举该栗子的时候百度是还没符合ATS的要求的,现在百度已经支持ATS),如果在App中请求https://www.baidu.com的话,是会收到如下的错误信息:

NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9802)

查阅了一下官方资料(https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html#//apple_ref/doc/uid/TP40009251-SW33),发现HTTPS的请求需要满足下面的要求:

Requirements for Connecting Using ATS

With ATS fully enabled, your app’s HTTP connections must use HTTPS and must satisfy the following security requirements:

The server certificate must meet at least one of the following trust requirements:

Issued by a certificate authority (CA) whose root certificate is incorporated into the operating system

Issued by a trusted root CA and installed by the user or a system administrator

The negotiated Transport Layer Security version must be TLS 1.2

The negotiated TLS connection cipher suite must support forward secrecy (FS) and be one of the following:

TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384

TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256

TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384

TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA

TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256

TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA

TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384

TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256

TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384

TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256

TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA

The leaf server certificate must be signed with one of the following types of keys:

Rivest-Shamir-Adleman (RSA) key with a length of at least 2048 bits

Elliptic-Curve Cryptography (ECC) key with a size of at least 256 bits

In addition, the leaf server certificate hashing

algorithm must be Secure Hash Algorithm 2 (SHA-2) with a digest length

of at least 256 (that is, SHA-256 or greater).

根据原文描述,首先颁发给服务器证书的证书机构(CA)的根证书必须是内置于操作系统(哪些根证书被信任可以查看https://support.apple.com/zh-cn/HT205205,或者在你的机子的设置-通用-关于本机最下面的“进一步了解被信任的证书”中查看)或者受用户或者系统管理员信任并安装到操作系统上的。而且必须要基于TLS 1.2版本协议。再来就是连接的加密方式要提供Forward Secrecy(FS正向保密,感兴趣的筒子可以看看这个https://vincent.bernat.im/en/blog/2011-ssl-perfect-forward-secrecy.html),文档中罗列出了支持的加密算法(上面的原文中有说明,我把它独立抽出来放到下面表格中查看)。最后就是证书至少要使用一个SHA256的指纹与任一个2048位或者更高位的RSA密钥,或者是256位或者更高位的ECC密钥。如果不符合其中一项,请求将被中断并返回nil。

支持Forward Secrecy的加密方式

TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384

TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256

TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384

TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA

TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256

TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA

TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384

TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256

TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384

TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256

TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA

我们再来看刚才的百度的地址,用浏览器打开百度的地址,然后点击链接前面的锁图标,如图:

可以看到它使用了TLS 1.2版本协议,符合上面所说的TLS版本的约定。

然后在点击证书信息,查看颁发给它证书的CA的根证书,如图:

可以看到它的根证书名称是:VeriSign Class 3 Public Primary Certification Authority - G5,根据这个名字在之前提供URL中去寻找iOS9下受信任的根证书是否有存在该证书,结果是可以找到对应的证书信息的,如下图所示:

最后回到之前的连接信息面板可以看到使用AES_128_GCM进行加密,并使用ECDHE_RSA作为密钥交换机制的,我们可以在Forward Secrecy的列表中找到对应两条记录:

TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384

TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256

但是还不能确定百度是否提供Forward Secrecy,我们再点开证书信息,查看“签发者名称”和“公共密钥信息”两项,如图:

看到签名算法中写着“带RSA加密的SHA-1”。可以判定该加密算法不包含在上面两项中。因此百度是一个不符合ATS的要求,所以返回了错误。这时候,如果要解决这样的问题,同样需要对ATS进行配置。配置如下:

NSAppTransportSecurityNSExceptionDomainsbaidu.comNSIncludesSubdomainsNSExceptionRequiresForwardSecrecyNSExceptionAllowsInsecureHTTPLoads

其中NSIncludesSubdomains设置为YES表示百度的子级域名都使用相同设置。

NSExceptionRequiresForwardSecrecy为NO由于百度不支持ForwardSecrecy,因此屏蔽掉改功能。最后

NSExceptionAllowInsecureHTTPLoads设置为YES,则表示允许访问没有证书或者是自签名、过期、主机名不匹配的证书引发

的错误的域名(这里检查过百度的证书貌似没有什么问题,但是还是需要设置此项才允许访问)。

----------------------------

在最近的测试中由于百度已经支持ATS(昨天@Jolie_Yang给我留言才知道的^_^),而我在不配置任何ATS设置的时候使用

NSURLConnection去测试https://www.baidu.com返回的结果还是报错的。后来,我用NSURLSession去测试该网

址发现是可以正常访问。

苹果官方是推荐使用NSURLSession去做HTTP请求的,虽然说

NSURLConnection同样支持ATS方面的特性,但从我上面的测试来看估计它们两者的默认行为上有些不一样,所以如果还在使用

NSURLConnection的同学应该尽早切换到NSURLSession上,避免产生一些不必要错误。

最后,说到如何诊断一个URL是否支持ATS,这里给大家介绍一些nscurl这个命令行工具,这个工具是OS X v10.11上新增的,主要用于诊断ATS带来的连接问题,利用它可以在命令行中直接检测一个URL地址是否支持ATS。其用法如下:

/usr/bin/nscurl--ats-diagnostics [--verbose] URL

URL - 表示用来诊断的网址

verbose - 该选项将会为每次的连接包含更多信息,包括使用到Info.plist中的哪些key和对应的值也会列出来。

还是以百度为例,对其https://baidu.com进行诊断,命令如下:

nscurl --ats-diagnosticshttps://baidu.com

其输出信息如下:

Configuring ATS Info.plist keys and displaying the result of HTTPS loads to https://baidu.com.Atestwill"PASS"ifURLSession:task:didCompleteWithError: returns a nil error.Use'--verbose'to view the ATS dictionaries used and to display the error receivedinURLSession:task:didCompleteWithError:.================================================================================Default ATS Secure Connection---ATS Default Connection2016-07-19 17:51:43.156 nscurl[7936:828662] App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file.Result : FAIL---================================================================================Allowing Arbitrary Loads---Allow All LoadsResult : PASS---================================================================================Configuring TLS exceptions for baidu.com---TLSv1.2Result : FAIL------TLSv1.1Result : FAIL------TLSv1.0Result : FAIL---================================================================================Configuring PFS exceptions for baidu.com---Disabling Perfect Forward SecrecyResult : FAIL---================================================================================Configuring PFS exceptions and allowing insecure HTTP for baidu.com---Disabling Perfect Forward Secrecy and Allowing Insecure HTTPResult : FAIL---================================================================================Configuring TLS exceptions with PFS disabled for baidu.com---TLSv1.2 with PFS disabledResult : FAIL------TLSv1.1 with PFS disabledResult : FAIL------TLSv1.0 with PFS disabledResult : FAIL---================================================================================Configuring TLS exceptions with PFS disabled and insecure HTTP allowed for baidu.com---TLSv1.2 with PFS disabled and insecure HTTP allowedResult : FAIL------TLSv1.1 with PFS disabled and insecure HTTP allowedResult : FAIL------TLSv1.0 with PFS disabled and insecure HTTP allowedResult : FAIL---================================================================================

可以看到除了Allowing Arbitrary

Loads一项的Result是Pass,其他的Result都是FAIL,那这证明了baidu.com还没有支持ATS,但是从它的证书来看是已经支

持的了,为了了解更详细的信息,我们把verbose选项加入再进行诊断一下,来了解更多的信息,命令如下:

nscurl --ats-diagnostics --verbosehttps://baidu.com

其信息输出如下:

vimfungdeMac-mini:~ vimfung$ nscurl --ats-diagnostics --verbose https://baidu.comStarting ATS DiagnosticsConfiguring ATS Info.plist keys and displaying the result of HTTPS loads to https://baidu.com.Atestwill"PASS"ifURLSession:task:didCompleteWithError: returns anilerror.================================================================================Default ATS Secure Connection---ATS Default ConnectionATS Dictionary:{}2016-07-1917:57:24.887nscurl[7971:833843] App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file.Result : FAILError : Error Domain=NSURLErrorDomainCode=-1022"The resource could not be loaded because the App Transport Security policy requires the use of a secure connection."UserInfo={NSUnderlyingError=0x7fac41703970{Error Domain=kCFErrorDomainCFNetwork Code=-1022"(null)"},NSErrorFailingURLStringKey=http://www.baidu.com/, NSErrorFailingURLKey=http://www.baidu.com/, NSLocalizedDescription=The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.}---================================================================================Allowing Arbitrary Loads---Allow All LoadsATS Dictionary:{NSAllowsArbitraryLoads=true;}Result : PASS---================================================================================Configuring TLS exceptionsforbaidu.com---TLSv1.2ATS Dictionary:{NSExceptionDomains=    {"baidu.com"=        {NSExceptionMinimumTLSVersion="TLSv1.2";        };    };}Result : FAILError : Error Domain=NSURLErrorDomainCode=-1022"The resource could not be loaded because the App Transport Security policy requires the use of a secure connection."UserInfo={NSUnderlyingError=0x7fac4164cc20{Error Domain=kCFErrorDomainCFNetwork Code=-1022"(null)"},NSErrorFailingURLStringKey=http://www.baidu.com/, NSErrorFailingURLKey=http://www.baidu.com/, NSLocalizedDescription=The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.}------TLSv1.1ATS Dictionary:{NSExceptionDomains=    {"baidu.com"=        {NSExceptionMinimumTLSVersion="TLSv1.1";        };    };}Result : FAILError : Error Domain=NSURLErrorDomainCode=-1022"The resource could not be loaded because the App Transport Security policy requires the use of a secure connection."UserInfo={NSUnderlyingError=0x7fac4143dfc0{Error Domain=kCFErrorDomainCFNetwork Code=-1022"(null)"},NSErrorFailingURLStringKey=http://www.baidu.com/, NSErrorFailingURLKey=http://www.baidu.com/, NSLocalizedDescription=The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.}------TLSv1.0ATS Dictionary:{NSExceptionDomains=    {"baidu.com"=        {NSExceptionMinimumTLSVersion="TLSv1.0";        };    };}Result : FAILError : Error Domain=NSURLErrorDomainCode=-1022"The resource could not be loaded because the App Transport Security policy requires the use of a secure connection."UserInfo={NSUnderlyingError=0x7fac4143e480{Error Domain=kCFErrorDomainCFNetwork Code=-1022"(null)"},NSErrorFailingURLStringKey=http://www.baidu.com/, NSErrorFailingURLKey=http://www.baidu.com/, NSLocalizedDescription=The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.}---================================================================================Configuring PFS exceptionsforbaidu.com---Disabling Perfect Forward SecrecyATS Dictionary:{NSExceptionDomains=    {"baidu.com"=        {NSExceptionRequiresForwardSecrecy=false;        };    };}Result : FAILError : Error Domain=NSURLErrorDomainCode=-1022"The resource could not be loaded because the App Transport Security policy requires the use of a secure connection."UserInfo={NSUnderlyingError=0x7fac414358c0{Error Domain=kCFErrorDomainCFNetwork Code=-1022"(null)"},NSErrorFailingURLStringKey=http://www.baidu.com/, NSErrorFailingURLKey=http://www.baidu.com/, NSLocalizedDescription=The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.}---================================================================================Configuring PFS exceptions and allowing insecure HTTPforbaidu.com---Disabling Perfect Forward Secrecy and Allowing Insecure HTTPATS Dictionary:{NSExceptionDomains=    {"baidu.com"=        {NSExceptionAllowsInsecureHTTPLoads=true;NSExceptionRequiresForwardSecrecy=false;        };    };}Result : FAILError : Error Domain=NSURLErrorDomainCode=-1022"The resource could not be loaded because the App Transport Security policy requires the use of a secure connection."UserInfo={NSUnderlyingError=0x7fac416589a0{Error Domain=kCFErrorDomainCFNetwork Code=-1022"(null)"},NSErrorFailingURLStringKey=http://www.baidu.com/, NSErrorFailingURLKey=http://www.baidu.com/, NSLocalizedDescription=The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.}---================================================================================Configuring TLS exceptions with PFS disabledforbaidu.com---TLSv1.2with PFS disabledATS Dictionary:{NSExceptionDomains=    {"baidu.com"=        {NSExceptionMinimumTLSVersion="TLSv1.2";NSExceptionRequiresForwardSecrecy=false;        };    };}Result : FAILError : Error Domain=NSURLErrorDomainCode=-1022"The resource could not be loaded because the App Transport Security policy requires the use of a secure connection."UserInfo={NSUnderlyingError=0x7fac41633bf0{Error Domain=kCFErrorDomainCFNetwork Code=-1022"(null)"},NSErrorFailingURLStringKey=http://www.baidu.com/, NSErrorFailingURLKey=http://www.baidu.com/, NSLocalizedDescription=The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.}------TLSv1.1with PFS disabledATS Dictionary:{NSExceptionDomains=    {"baidu.com"=        {NSExceptionMinimumTLSVersion="TLSv1.1";NSExceptionRequiresForwardSecrecy=false;        };    };}Result : FAILError : Error Domain=NSURLErrorDomainCode=-1022"The resource could not be loaded because the App Transport Security policy requires the use of a secure connection."UserInfo={NSUnderlyingError=0x7fac414625e0{Error Domain=kCFErrorDomainCFNetwork Code=-1022"(null)"},NSErrorFailingURLStringKey=http://www.baidu.com/, NSErrorFailingURLKey=http://www.baidu.com/, NSLocalizedDescription=The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.}------TLSv1.0with PFS disabledATS Dictionary:{NSExceptionDomains=    {"baidu.com"=        {NSExceptionMinimumTLSVersion="TLSv1.0";NSExceptionRequiresForwardSecrecy=false;        };    };}Result : FAILError : Error Domain=NSURLErrorDomainCode=-1022"The resource could not be loaded because the App Transport Security policy requires the use of a secure connection."UserInfo={NSUnderlyingError=0x7fac41464e40{Error Domain=kCFErrorDomainCFNetwork Code=-1022"(null)"},NSErrorFailingURLStringKey=http://www.baidu.com/, NSErrorFailingURLKey=http://www.baidu.com/, NSLocalizedDescription=The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.}---================================================================================Configuring TLS exceptions with PFS disabled and insecure HTTP allowedforbaidu.com---TLSv1.2with PFS disabled and insecure HTTP allowedATS Dictionary:{NSExceptionDomains=    {"baidu.com"=        {NSExceptionAllowsInsecureHTTPLoads=true;NSExceptionMinimumTLSVersion="TLSv1.2";NSExceptionRequiresForwardSecrecy=false;        };    };}Result : FAILError : Error Domain=NSURLErrorDomainCode=-1022"The resource could not be loaded because the App Transport Security policy requires the use of a secure connection."UserInfo={NSUnderlyingError=0x7fac41468d40{Error Domain=kCFErrorDomainCFNetwork Code=-1022"(null)"},NSErrorFailingURLStringKey=http://www.baidu.com/, NSErrorFailingURLKey=http://www.baidu.com/, NSLocalizedDescription=The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.}------TLSv1.1with PFS disabled and insecure HTTP allowedATS Dictionary:{NSExceptionDomains=    {"baidu.com"=        {NSExceptionAllowsInsecureHTTPLoads=true;NSExceptionMinimumTLSVersion="TLSv1.1";NSExceptionRequiresForwardSecrecy=false;        };    };}Result : FAILError : Error Domain=NSURLErrorDomainCode=-1022"The resource could not be loaded because the App Transport Security policy requires the use of a secure connection."UserInfo={NSUnderlyingError=0x7fac4146a6e0{Error Domain=kCFErrorDomainCFNetwork Code=-1022"(null)"},NSErrorFailingURLStringKey=http://www.baidu.com/, NSErrorFailingURLKey=http://www.baidu.com/, NSLocalizedDescription=The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.}------TLSv1.0with PFS disabled and insecure HTTP allowedATS Dictionary:{NSExceptionDomains=    {"baidu.com"=        {NSExceptionAllowsInsecureHTTPLoads=true;NSExceptionMinimumTLSVersion="TLSv1.0";NSExceptionRequiresForwardSecrecy=false;        };    };}Result : FAILError : Error Domain=NSURLErrorDomainCode=-1022"The resource could not be loaded because the App Transport Security policy requires the use of a secure connection."UserInfo={NSUnderlyingError=0x7fac416932b0{Error Domain=kCFErrorDomainCFNetwork Code=-1022"(null)"},NSErrorFailingURLStringKey=http://www.baidu.com/, NSErrorFailingURLKey=http://www.baidu.com/, NSLocalizedDescription=The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.}---================================================================================

可以看到了更多的信息,包括了Info.plist中的配置项和请求的错误描述信息。其中发现当请求https://baidu.com的时候,它

会报NSErrorFailingURLKey=http://www.baidu.com。所以,我估计是百度对这个网址进行了跳转,而跳转到的地址就

是http://www.baidu.com,所以不可靠的HTTP连接都被ATS被拦截了,才会出现Fail的结果。

因此,我尝试换了https://www.baidu.com再次进行测试,其输入结果如下:

vimfungdeMac-mini:~ vimfung$ nscurl --ats-diagnostics --verbose https://www.baidu.comStarting ATS DiagnosticsConfiguring ATS Info.plist keys and displaying the result of HTTPS loads to https://www.baidu.com.Atestwill"PASS"ifURLSession:task:didCompleteWithError: returns a nil error.================================================================================Default ATS Secure Connection---ATS Default ConnectionATS Dictionary:{}Result : PASS---================================================================================Allowing Arbitrary Loads---Allow All LoadsATS Dictionary:{    NSAllowsArbitraryLoads =true;}Result : PASS---================================================================================Configuring TLS exceptionsforwww.baidu.com---TLSv1.2ATS Dictionary:{    NSExceptionDomains =    {"www.baidu.com"=        {            NSExceptionMinimumTLSVersion ="TLSv1.2";        };    };}Result : PASS------TLSv1.1ATS Dictionary:{    NSExceptionDomains =    {"www.baidu.com"=        {            NSExceptionMinimumTLSVersion ="TLSv1.1";        };    };}Result : PASS------TLSv1.0ATS Dictionary:{    NSExceptionDomains =    {"www.baidu.com"=        {            NSExceptionMinimumTLSVersion ="TLSv1.0";        };    };}Result : PASS---================================================================================Configuring PFS exceptionsforwww.baidu.com---Disabling Perfect Forward SecrecyATS Dictionary:{    NSExceptionDomains =    {"www.baidu.com"=        {            NSExceptionRequiresForwardSecrecy =false;        };    };}Result : PASS---================================================================================Configuring PFS exceptions and allowing insecure HTTPforwww.baidu.com---Disabling Perfect Forward Secrecy and Allowing Insecure HTTPATS Dictionary:{    NSExceptionDomains =    {"www.baidu.com"=        {            NSExceptionAllowsInsecureHTTPLoads =true;            NSExceptionRequiresForwardSecrecy =false;        };    };}Result : PASS---================================================================================Configuring TLS exceptions with PFS disabledforwww.baidu.com---TLSv1.2with PFS disabledATS Dictionary:{    NSExceptionDomains =    {"www.baidu.com"=        {            NSExceptionMinimumTLSVersion ="TLSv1.2";            NSExceptionRequiresForwardSecrecy =false;        };    };}Result : PASS------TLSv1.1with PFS disabledATS Dictionary:{    NSExceptionDomains =    {"www.baidu.com"=        {            NSExceptionMinimumTLSVersion ="TLSv1.1";            NSExceptionRequiresForwardSecrecy =false;        };    };}Result : PASS------TLSv1.0with PFS disabledATS Dictionary:{    NSExceptionDomains =    {"www.baidu.com"=        {            NSExceptionMinimumTLSVersion ="TLSv1.0";            NSExceptionRequiresForwardSecrecy =false;        };    };}Result : PASS---================================================================================Configuring TLS exceptions with PFS disabled and insecure HTTP allowedforwww.baidu.com---TLSv1.2with PFS disabled and insecure HTTP allowedATS Dictionary:{    NSExceptionDomains =    {"www.baidu.com"=        {            NSExceptionAllowsInsecureHTTPLoads =true;            NSExceptionMinimumTLSVersion ="TLSv1.2";            NSExceptionRequiresForwardSecrecy =false;        };    };}Result : PASS------TLSv1.1with PFS disabled and insecure HTTP allowedATS Dictionary:{    NSExceptionDomains =    {"www.baidu.com"=        {            NSExceptionAllowsInsecureHTTPLoads =true;            NSExceptionMinimumTLSVersion ="TLSv1.1";            NSExceptionRequiresForwardSecrecy =false;        };    };}Result : PASS------TLSv1.0with PFS disabled and insecure HTTP allowedATS Dictionary:{    NSExceptionDomains =    {"www.baidu.com"=        {            NSExceptionAllowsInsecureHTTPLoads =true;            NSExceptionMinimumTLSVersion ="TLSv1.0";            NSExceptionRequiresForwardSecrecy =false;        };    };}Result : PASS---================================================================================

输出的结果都是Pass的了,那证明百度还是支持ATS的。好了,这是我最新对ATS的研究,希望对大家有用。


转自:http://my.oschina.net/vimfung/blog/494687

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 203,324评论 5 476
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 85,303评论 2 381
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 150,192评论 0 337
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 54,555评论 1 273
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 63,569评论 5 365
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 48,566评论 1 281
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 37,927评论 3 395
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,583评论 0 257
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 40,827评论 1 297
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,590评论 2 320
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 37,669评论 1 329
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,365评论 4 318
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 38,941评论 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 29,928评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,159评论 1 259
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 42,880评论 2 349
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,399评论 2 342

推荐阅读更多精彩内容