3
當我從我的包中從p12文件讀取nsdata時,我可以提取標識。當我從p12文件讀取nsdata時提取標識
NSData *PKCS12Data = [NSData dataWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"sample" ofType:@"p12"]];
但是當我保存它作爲BLOB和嘗試創建NSData的
PKCS12 *newp12;
using NSData *PKCS12Data = [[NSData alloc] initWithBytes:&p12ptr length:length];
失敗....錯誤代碼-26275 osstatus。兩個事件nsdata顯示相同的字節..任何編碼問題? 請幫助
我使用提取的身份下面的代碼
securityError = SecPKCS12Import((CFDataRef)inPKCS12Data,(CFDictionaryRef)optionsDictionary,&items);
if (securityError == 0) {
CFDictionaryRef myIdentityAndTrust = CFArrayGetValueAtIndex (items, 0);
const void *tempIdentity = NULL;
tempIdentity = CFDictionaryGetValue (myIdentityAndTrust, kSecImportItemIdentity);
*outIdentity = (SecIdentityRef)tempIdentity;
const void *tempTrust = NULL;
tempTrust = CFDictionaryGetValue (myIdentityAndTrust, kSecImportItemTrust);
*outTrust = (SecTrustRef)tempTrust;
} else
{
NSLog(@"Failed with error code %d",(int)securityError);
return NO;
}
你是什麼意思的'存儲爲一個blob'? 'newp12'與'p12ptr'相同嗎?如果不是,那麼'p12ptr'的類型是什麼? – 2011-06-27 12:14:28