ASIHTTPRequest-客户端证书支持

来源:互联网 发布:滴滴大数据研究中心 编辑:程序博客网 时间:2024/06/05 03:02

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

// Will send the certificate attached to the identity (identity is a SecIdentityRef)[request setClientCertificateIdentity:identity]; // Add an additional certificate (where cert is a SecCertificateRef)[request setClientCertificates:[NSArray arrayWithObject:(id)cert]];

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