Ios 设备日志中的警告扇区[leaf AnchorTrusted]
我有以下检索私钥的代码Ios 设备日志中的警告扇区[leaf AnchorTrusted],ios,security,Ios,Security,我有以下检索私钥的代码 -(SecKeyRef)getKey:(NSData *)pkcs12Data { SecKeyRef privateKeyRef = nil; if(pkcs12Data ==nil || pkcs12Data.length==0) { return privateKeyRef; } NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys: @
-(SecKeyRef)getKey:(NSData *)pkcs12Data
{
SecKeyRef privateKeyRef = nil;
if(pkcs12Data ==nil || pkcs12Data.length==0)
{
return privateKeyRef;
}
NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys: @"", kSecImportExportPassphrase, nil];
CFArrayRef items = CFArrayCreate(NULL, 0, 0, NULL);
// this line gives the warning <Error>: Nov xxxxxxx SecTrustEvaluate [leaf AnchorTrusted]
OSStatus returnCode = SecPKCS12Import(
(__bridge CFDataRef) pkcs12Data,
(__bridge CFDictionaryRef) options,
& items
);
if(errSecSuccess == returnCode)
{
NSDictionary *item = (NSDictionary*) CFArrayGetValueAtIndex(items, 0);
SecIdentityRef identity = (__bridge SecIdentityRef) [item objectForKey:(__bridge NSString *) kSecImportItemIdentity];
SecIdentityCopyPrivateKey(identity, &privateKeyRef);
}
else
{
NSLog(@"failed “);
}
return privateKeyRef;
}
-(SecKeyRef)getKey:(NSData*)pkcs12Data
{
SecKeyRef privateKeyRef=nil;
if(pkcs12Data==nil | | pkcs12Data.length==0)
{
返回privateKeyRef;
}
NSDictionary*选项=[NSDictionary Dictionary WithObjectsAndKeys:@',kSecImportExportPassphrase,nil];
CFArrayRef items=CFArrayCreate(NULL,0,0,NULL);
//该行给出警告:11月xxxxxxx节锈评估[叶锚锈]
OSStatus returnCode=SecPKCS12Import(
(_桥CFDataRef)PKCS12数据,
(_桥CFYREF)选项,
&项目
);
if(errSecSuccess==returnCode)
{
NSDictionary*项=(NSDictionary*)CFArrayGetValueAtIndex(项,0);
SecIdentityRef identity=(u桥SecIdentityRef)[item objectForKey:(u桥NSString*)kSecImportItemIdentity];
SecIdentityCopyPrivateKey(身份和私钥参考);
}
其他的
{
NSLog(@“失败”);
}
返回privateKeyRef;
}
其中pkcs12Data是.pfx文件的数据。
虽然一切正常,但我在设备日志的SecTrustEvaluate[leaf AnchorTrusted]中收到警告。我没有任何理由这样做。请告诉我如何消除此警告