ASIHTTPRequest-客戶端證書支持

有時服務器要求提供客戶端證書,從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)。

發佈了10 篇原創文章 · 獲贊 1 · 訪問量 11萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章