有時服務器要求提供客戶端證書,從1.8版本開始,你可以隨request發送證書。
1
2
3
4
5
|
//
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)。