ASIHTTPRequest-客户端证书支持

来源:互联网 发布:中国邮政网络 客户端 编辑:程序博客网 时间:2024/06/06 12:20

有时服务器要求提供客户端证书,从1.8版本开始,你可以随request发送证书。

1
2
3
4
5
// Will send the certificate attached to the identity (identity is a SecIdentityRef)
[requestsetClientCertificateIdentity:identity];
 
// Add an additional certificate (where cert is a SecCertificateRef)
[requestsetClientCertificates:[NSArrayarrayWithObject:(id)cert]];

在iPhone/iPad示例工程中的ClientCertificateTests.m中有一个很有用的函数用来从PKCS12数据创建SecIdentityRef (这个函数仅适用于iOS)。

原创粉丝点击