ios - 如何在 NSURLRequest 中附加 TLS/SSL 证书?

标签 ios objective-c ssl nsurlrequest

我需要与服务器通信,我需要为每个 NSURLRequest 附加一个自签名的 TLS 证书。

有办法吗?

最佳答案

您的连接委托(delegate)应实现 connection:canAuthenticateAgainstProtectionSpace: 并回答 YES。完成后,您的代表将收到 connection:didReceiveAuthenticationChallenge:

要继续处理证书,该方法应回答 NSURLCredential。使用您的证书创建其中一个

+ (NSURLCredential *)credentialWithIdentity:(SecIdentityRef)identity certificates:(NSArray *)certArray persistence:(NSURLCredentialPersistence)persistence

关于ios - 如何在 NSURLRequest 中附加 TLS/SSL 证书?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15115311/

相关文章:

没有开发者许可证/应用商店的 iOS 应用

iphone - 在 Safari 中打开 URL 而不是 webView

ios - 调整 subview 大小时的自动布局问题

PHP 服务器端 SNI 支持

php - 如何让 SSL+mod_rewrite+Zend Framework MVC 一起工作?

c# - 在 .net core 应用程序中自托管 HTTP(s) 端点而不使用 asp.net?

ios - iBeacon iOS 10 : Can device scan for and receive advertisements from other peripheral devices?

ios - 使用 Swift 显示当前播放的 .MP3 的标题

ios - iphone-在第二个 ViewController 中更改 float

java - C/objC/C++/Java 编译器