- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
从一开始,我是如何配置NSURLSession
的:
auto securityPolicy = self.securityPolicy;
NSURLSessionConfiguration *config = [NSURLSessionConfiguration ephemeralSessionConfiguration];
config.TLSMinimumSupportedProtocol = [CSHTTPSessionWrapper minimumTLSprotocolForSecurityPolicy: securityPolicy]; // this properly sets values kTLSProtocol1, kTLSProtocol11, kTLSProtocol12
self.session = [NSURLSession sessionWithConfiguration: config
delegate: self
delegateQueue: nil];
没什么特别的。
现在我编写了一些自动化测试,将安全策略设置为 TLS 1.0、1.1、1.2 并尝试连接到 openssl
服务器。我写了启动这个服务器的 python 脚本:
def run_ssl_server(name, openSSLBinary, port, params):
print "Starting {0} server on port {1}".format(name, port)
proc = subprocess.Popen([openSSLBinary, "s_server", "-cert", "testres/server.cert.pem", "-key", "testres/server.key.pem", "-debug", "-www", "-accept"] + [port] + params)
atexit.register(proc.terminate)
print "Server started. Pid={0}".format(proc.pid)
def main() :
… … …
openSSLBinary = arguments.openSSLBinary # use custom build of openssl
server_modes = {
'normal': ('4433', []),
'ssl3_only': ('4435', ['-ssl3'])
}
openSSLVersion = open_ssl_tool_version(openSSLBinary)
if openSSLVersion >= LooseVersion("1.0.0") :
print "Adding servers which can be configured for openssl 1.0.0"
server_modes.update({
'no_tls2' : ('4434', ['-no_tls1_2']),
'tls1' : ('4436', ['-tls1']),
'tls1_1' : ('4437', ['-tls1_1']),
'tls1_2' : ('4438', ['-tls1_2']),
})
… … …
由于预装的 openssl
很旧 OpenSSL 0.9.8zh 2016 年 1 月 14 日
我构建了新版本并将其提供给我的 python 脚本。
现在测试正在检查客户端最低 TLS 版本和服务器 TLS 版本的所有组合。在 Mac OS 上,所有测试都通过了!
奇怪的是,当客户端的最低 TLS 版本高于服务器支持的版本时,在 iOS 模拟器上运行的完全相同的测试会失败。 NSURLSSession
返回成功,没有错误报告(它们应该)!
我对套接字(NSInputStream
和 NSOutputStream
)所做的测试完全相同,并且在 Mac 和 iOS 模拟器上运行并且它们都通过了,所以问题不是模拟器上的端口转发.
看起来 NSURLSessionConfiguration
TLSMinimumSupportedProtocol
在 iOS 上不起作用!
有没有人有任何建议,线索?或者我应该向 Apple 提交错误报告(我讨厌 Apple 使用的错误跟踪器)?
最佳答案
好的问题在 iOS 10 上无法重现,所以显然 Apple 已经修复了这个错误(我已经使用 Xcode 8.2.1 重新运行测试)。
最初我使用 iOS 9 (Xcode 7.2) 进行测试。
关于ios - NSURLSessionConfiguration TLSMinimumSupportedProtocol 看起来在 iOS 上不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42834164/
我已经使用默认配置定义了 session 配置,并提供了 tlsMinimumSupportedProtocol 作为 TLSv1.2 我正在使用 Alamofire,但我的应用程序仍然支持较低版本
从一开始,我是如何配置NSURLSession的: auto securityPolicy = self.securityPolicy; NSURLSessionConfiguration *conf
我是一名优秀的程序员,十分优秀!