有时服务器要求提供客户端证书,从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)。