HTML5   发布时间:2022-04-27  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了ios – 如何在设备中检查安全区域是否可用大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我们知道安全的Enclave是一个在Apple A7中制造的协处理器,它在A7及更高版本中可用,但它在iOS 9 kSecAttrTokenIDSecureEnclave中公开使用,但我们如何检查某些设备是否支持安全区?
谢谢

解决方法

我没找到任何所以我做了自己的检查:

+ (BOOL) isDeviceOkForSecureEnclave
{

    double OSVersionnumber                  = floor(NSFoundationVersionnumber);
    UIUserInterfaceI@L_140_3@m deviCEType         = [[UIDevice currentDevice] userInterfaceI@L_140_3@m];

    BOOL isOSForSecureEnclave               = OSVersionnumber > NSFoundationVersionnumber_iOS_8_4 ? YES:NO;
    //iOS 9 and up are ready for SE


    BOOL isDeviceModelForSecureEnclave  = NO;

    switch (deviCETypE) {

        case UIUserInterfaceIdio@R_731_6165@:
            //iPhone
            isDeviceModelForSecureEnclave = [self isPhoneForSE];
            break;
        case UIUserInterfaceI@L_140_3@mPad:
            //iPad
            isDeviceModelForSecureEnclave = [self isPadForSE];

            break;
        default:
            isDeviceModelForSecureEnclave = false;
            break;
    }

    return (isOSForSecureEnclave && isDeviceModelForSecureEnclavE) ? YES:NO;
}


/**
 The arrays are models that we kNow not having SE in hardware,so if the current device is on the list it means it dosent have SE
 */

+ (BOOL) isPhoneForSE
{
    NSString *thisPlatform = [self platform];
    NSArray * oldModels = [NSArray arrayWithObjects:
                           @"x86_64",@"iPhone1,1",2",@"iPhone2,@"iPhone3,3",@"iPhone4,@"iPhone5,4",nil];

    BOOL isInList = [oldModels containsObject: thisPlatform];
    return !isInList;
}


+ (BOOL) isPadForSE
{
    //iPad Mini 2 is the earliest with SE // "iPad4,4"
    NSString *thisPlatform = [self platform];

    NSArray * oldModels = [NSArray arrayWithObjects:
                           @"x86_64",@"@iPad",@"@iPad1,0",@"iPad2,5",6",7",@"iPad3,nil];

    BOOL isInList = [oldModels containsObject: thisPlatform];

    return !isInList;

}


+ (NSString *)platform
{
    size_t size;
    sysctlbyname("hw.machine",NULL,&size,0);
    char *machine = malloc(sizE);
    sysctlbyname("hw.machine",machine,0);
    NSString *platform = [NSString StringWithUTF8String:machine];
    free(machinE);

    return platform;

}

@end

检查触摸ID

- (BOOL)canAuthenticateByTouchId {
if ([LAContext class]) {
    return [[[LAContext alloc] init] canEvaluatePolicy:LAPolicyDeviceownerAuthenticationWithBiometrics error:nil];
}
return YES;
}

您还可以找到Secure Enclave here you find的检测

大佬总结

以上是大佬教程为你收集整理的ios – 如何在设备中检查安全区域是否可用全部内容,希望文章能够帮你解决ios – 如何在设备中检查安全区域是否可用所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。