How to use Client Certificate Authentication in iOS App(如何在 iOS 应用中使用客户端证书身份验证)
问题描述
我没有太多关于客户端证书身份验证的经验.谁能告诉我如何在 iOS 应用程序中使用它?谢谢:)
I don't have a lot experience about Client Certificate Authentication. Anybody can tell me how to use it in iOS app? Thanks :)
推荐答案
你的 NSURLConnection 委托应该响应 connection:didReceiveAuthenticationChallenge:
委托方法(参见下面的链接).
Your NSURLConnection delegate should respond to the connection:didReceiveAuthenticationChallenge:
delegate method (see link below).
http://developer.apple.com/library/ios/documentation/cocoa/reference/foundation/Classes/NSURLConnection_Class/Reference/Reference.html#//apple_ref/occ/instm/NSObject/connection:didReceiveAuthenticationChallenge:
它应该通过询问其发送者"的质询并为其提供适当的凭据来响应.
It should respond by asking the challenge for its 'sender' and providing it with an appropriate credential.
类似:
- (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge {
id sender = [challenge sender];
// create a credential from a certificate
// see doco for details of the parameters
NSURLCredential *creds = [NSURLCredential credentialWithIdentity:ident certificates:certs persistence:persistence];
[sender useCredential:creds forAuthenticationChallenge:challenge];
}
请参阅 NSURLCredential 类参考,了解如何基于证书创建凭据:
See the NSURLCredential class reference for details of how to create a credential based on a certificate:
这篇关于如何在 iOS 应用中使用客户端证书身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何在 iOS 应用中使用客户端证书身份验证


基础教程推荐
- UIWebView 委托方法 shouldStartLoadWithRequest:在 WKWebView 中等效? 2022-01-01
- 如何在没有IB的情况下将2个按钮添加到右侧的UINavigationbar? 2022-01-01
- Android:对话框关闭而不调用关闭 2022-01-01
- 如何让对象对 Cocos2D 中的触摸做出反应? 2022-01-01
- 当从同一个组件调用时,两个 IBAction 触发的顺序是什么? 2022-01-01
- android 应用程序已发布,但在 google play 中找不到 2022-01-01
- 如何在 UIImageView 中异步加载图像? 2022-01-01
- Kivy Buildozer 无法构建 apk,命令失败:./distribute.sh -m “kivy"d 2022-01-01
- 在 gmail 中为 ios 应用程序检索朋友的朋友 2022-01-01
- 如何在 iPhone 上显示来自 API 的 HTML 文本? 2022-01-01