Linux
1
Вклад в тег
- (BOOL)IsMobileConfigInstalled {
NSString *certPath = [[NSBundle mainBundle] pathForResource:@"cert" ofType:@"der"];
NSData *certData = [NSData dataWithContentsOfFile:certPath];
SecCertificateRef cert = NULL;
if ([certData length]) {
cert = SecCertificateCreateWithData(NULL, (__bridge CFDataRef) certData);
if (cert != NULL) {
CFStringRef certSummary = SecCertificateCopySubjectSummary(cert);
NSString *summaryString = [[NSString alloc] initWithString:(__bridge NSString *) certSummary];
CFRelease(certSummary);
}
}
SecPolicyRef policy = SecPolicyCreateBasicX509();
SecTrustRef trust;
OSStatus err = SecTrustCreateWithCertificates((__bridge CFArrayRef) @[
(__bridge id) cert
], policy, &trust);
SecTrustResultType trustResult = (SecTrustResultType) -1;
err = SecTrustEvaluate(trust, &trustResult);
CFRelease(trust);
CFRelease(policy);
CFRelease(cert);
NSString *ver = [[UIDevice currentDevice] systemVersion];
float ver_float = [ver floatValue];
if (ver_float >= 11)
return kSecTrustResultProceed == trustResult;
return kSecTrustResultUnspecified == trustResult;
}