苹果在2014年6月3日的WWDC2014开幕式上推出了新版iOS8系统,界面上iOS8与iOS7相比变化不大,不过在功能方面进行了完善。iOS8通知中心更加强大,支持消息直接回复操作,并支持QuickType和第三方输入法。短信功能改进明显,支持群聊,发送语音、视频,分享地理位置等。从终端用户的角度看,iOS8的许多新功能早已出现在其他平台中。iOS8会向第三方软件开放TouchID访问,这意味着可以使用该感应器登陆银行应用等。

第三方应用可以使用TouchID接口,意味着未来的很多应用都可以用指纹识别功能了。你可以选择Touch ID登陆第三方应用程序,不需要输入密码,你的指纹数据是被保护的,在没有被允许的情况下别的程序是访问不到它的。

                     

根据苹果的解释,一个单一的注册指纹与别人指纹出现随机匹配的概率为五万分之一。

苹果声称“Secure Enclave”模块系统能够安全地管理并识别用户的指纹,并将用户的指纹信息独立地保存在别的系统中,同时通过加密内存和一个硬件随机数字密码发生器进行管理。

每个“Secure Enclave”是单独设置的,不能访问系统其他部分的,拥有自己的独立的UID(唯一的ID),连苹果也不知道这些UID。当设备启动时,Touch ID会临时创建一个秘钥,与“Secure Enclave”的UID配合,对设备的内存空间进行加密。

而在苹果发布的文件中,苹果对A7处理器进行指纹识别授权的描述是:A7和Touch ID之间通过一个串行外设接口总线进行通信。A7处理器将数据发到“Secure Enclave”,但并不对数据内容进行读取。加密和身份验证都是使用Touch ID和“Secure Enclave”之间的共享密钥。通信密钥交换使用双方提供的一个随机AES密钥,并随机建立会话密钥和使用AES-CCM传输加密。

据了解:iPhone 5s中的指纹传感器检测到的表皮上突起的纹线。它检测到的不是用户手指外部的死皮指纹,这种指纹很容易被复制。iPhone 5s的指纹传感器利用射频信号,检测用户手指表面下方那一层皮肤的“活”指纹。如果手指与人的身体分离,那么传感器是无法检测到这种指纹的。所以用户不用担心自己的指纹被复制或盗窃之后,被用于解锁设备,因为传感器是无法识别这种“死”指纹的。

最近研究了下iOS8的文档,对指纹识别了解了下,并下载了一个官方提供的Demo。但是

NS_CLASS_AVAILABLE(10_10, 8_0)

从这句中可以看出,要想使用TouchID的接口,电脑的mac系统必须是10.10的,手机iOS系统必须是8.0,所以为了这个Demo我也没有升级电脑系统(毕竟还不稳定)。但根据Demo中的代码和文档可以看出,TouchID的基本用法。

1.首先要使用TouchID,要先导入依赖包:LocalAuthentication.framework

2.检查设备是否能用TouchID,返回检查结果BOOL类型success:

[objc]  view plain copy
  1. LAContext *context = [[LAContext alloc] init];
  2. __block  NSString *msg;
  3. NSError *error;
  4. BOOL success;
  5. // test if we can evaluate the policy, this test will tell us if Touch ID is available and enrolled
  6. success = [context canEvaluatePolicy: LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&error];
  7. if (success) {
  8. msg =[NSString stringWithFormat:NSLocalizedString(@"TOUCH_ID_IS_AVAILABLE", nil)];
  9. } else {
  10. msg =[NSString stringWithFormat:NSLocalizedString(@"TOUCH_ID_IS_NOT_AVAILABLE", nil)];
  11. }

3.如果设备能使用TouchID,代码块中返回识别结果BOOL类型的success:

[objc]  view plain copy
  1. LAContext *context = [[LAContext alloc] init];
  2. __block  NSString *msg;
  3. // show the authentication UI with our reason string
  4. [context evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics localizedReason:NSLocalizedString(@"UNLOCK_ACCESS_TO_LOCKED_FATURE", nil) reply:
  5. ^(BOOL success, NSError *authenticationError) {
  6. if (success) {
  7. msg =[NSString stringWithFormat:NSLocalizedString(@"EVALUATE_POLICY_SUCCESS", nil)];
  8. } else {
  9. msg = [NSString stringWithFormat:NSLocalizedString(@"EVALUATE_POLICY_WITH_ERROR", nil), authenticationError.localizedDescription];
  10. }
  11. }];

4.对于检查和识别的两个方法在 LocalAuthentication.framework/Headers/LAContext.h 中定义的:

[objc]  view plain copy
  1. /// Determines if a particular policy can be evaluated.
  2. ///
  3. /// @discussion Policies can have certain requirements which, when not satisfied, would always cause
  4. ///             the policy evaluation to fail. Examples can be a passcode set or a fingerprint
  5. ///             enrolled with Touch ID. This method allows easy checking for such conditions.
  6. ///
  7. ///             Applications should consume the returned value immediately and avoid relying on it
  8. ///             for an extensive period of time. At least, it is guaranteed to stay valid until the
  9. ///             application enters background.
  10. ///
  11. /// @warning    Do not call this method in the reply block of evaluatePolicy:reply: because it could
  12. ///             lead to a deadlock.
  13. ///
  14. /// @param policy Policy for which the preflight check should be run.
  15. ///
  16. /// @param error Optional output parameter which is set to nil if the policy can be evaluated, or it
  17. ///              contains error information if policy evaluation is not possible.
  18. ///
  19. /// @return YES if the policy can be evaluated, NO otherwise.
  20. - (BOOL)canEvaluatePolicy:(LAPolicy)policy error:(NSError * __autoreleasing *)error;
  21. /// Evaluates the specified policy.
  22. ///
  23. /// @discussion Policy evaluation may involve prompting user for various kinds of interaction
  24. ///             or authentication. Actual behavior is dependent on evaluated policy, device type,
  25. ///             and can be affected by installed configuration profiles.
  26. ///
  27. ///             Be sure to keep a strong reference to the context while the evaluation is in progress.
  28. ///             Otherwise, an evaluation would be canceled when the context is being deallocated.
  29. ///
  30. ///             The method does not block. Instead, the caller must provide a reply block to be
  31. ///             called asynchronously when evaluation finishes. The block is executed on a private
  32. ///             queue internal to the framework in an unspecified threading context. Other than that,
  33. ///             no guarantee is made about which queue, thread, or run-loop the block is executed on.
  34. ///
  35. ///             Implications of successful policy evaluation are policy specific. In general, this
  36. ///             operation is not idempotent. Policy evaluation may fail for various reasons, including
  37. ///             user cancel, system cancel and others, see LAError codes.
  38. ///
  39. /// @param policy Policy to be evaluated.
  40. ///
  41. /// @param reply Reply block that is executed when policy evaluation finishes.
  42. ///
  43. /// @param localizedReason Application reason for authentication. This string must be provided in correct
  44. ///                        localization and should be short and clear. It will be eventually displayed in
  45. ///                        the authentication dialog subtitle. A name of the calling application will be
  46. ///                        already displayed in title, so it should not be duplicated here.
  47. ///
  48. /// @param success Reply parameter that is YES if the policy has been evaluated successfully or NO if
  49. ///                the evaluation failed.
  50. ///
  51. /// @param error Reply parameter that is nil if the policy has been evaluated successfully, or it contains
  52. ///              error information about the evaluation failure.
  53. ///
  54. /// @warning localizedReason parameter is mandatory and the call will throw NSInvalidArgumentException if
  55. ///          nil or empty string is specified.
  56. ///
  57. /// @see LAError
  58. ///
  59. /// Typical error codes returned by this call are:
  60. /// @li          LAErrorUserFallback if user tapped the fallback button
  61. /// @li          LAErrorUserCancel if user has tapped the Cancel button
  62. /// @li          LAErrorSystemCancel if some system event interrupted the evaluation (e.g. Home button pressed).
  63. - (void)evaluatePolicy:(LAPolicy)policy localizedReason:(NSString *)localizedReason reply:(void(^)(BOOL success, NSError *error))reply;

欢迎小伙伴们对测试结果检验一下啊!

(转载请注明出处,谢谢!http://blog.csdn.net/yujianxiang666/article/details/35280025)

iOS8指纹识别TouchID相关推荐

  1. ios与android指纹识别,iOS 指纹登录(TouchID)集成方案

    TouchID指纹识别是iPhone 5S设备中增加的一项重大功能.苹果的后续移动设备也相继添加了指纹功能,在实际使用中还是相当方便的,比如快捷登录,快捷支付等等.系统提供了相应框架,使用起来还是比较 ...

  2. ios与android指纹识别,iOS开发实现TouchID指纹解锁

    一直想实现一下指纹解锁,苦于一直没时间,最近终于闲了下来所以翻了翻文档看了看demo,完成了这篇教程.本功能实现起来是很简单的,因为苹果都已经帮我们封装好了,只需要实现几个方法就可以了. 实现效果图 ...

  3. Apple屏下TouchID申请专利 短波红外光学指纹识别

    在疫情下使用FaceID相当有难度,这时便更显TouchID的方便性.而最近有消息指Apple已经申请专利,可以在不使用实体Home键的情况下,将屏下TouchID回归到iPhone上. 近日有消息指 ...

  4. 指纹登录 TouchID FaceID

    基础配置 #import <LocalAuthentication/LocalAuthentication.h> 判断是否支持指纹登录 //首先判断版本 if (NSFoundationV ...

  5. iPhone的指纹识别与面部识别(FaceID)

    我从简书搬家了 本文原地址:原地址 其实iPhone的指纹识别有很多教程,但其实有两套策略,而且好多都只写了一套,而且有的你会发现,错误码压根就试不出来啊,还以为苹果给的错误码都是瞎扯淡的. 首先,需 ...

  6. ios与android指纹识别,iOS开发swift -- 指纹识别

    //导入类库 import LocalAuthentication func touchID() { //创建上下文 let context = LAContext() var error : NSE ...

  7. Android 指纹识别(Touch ID)实例

    指纹识别   指纹识别的支持是Android6.0以后才开始的,Google也为指纹识别提供了一些列接口,指纹识别将要用到的核心API为FingerprintManager,其中还有三个核心内部类:F ...

  8. vivo在CES上展示的屏下指纹识别,能打败苹果的Face ID吗?

    iPhone X最大的缺点是什么?如果要我说,一定是没有了TouchID.苹果的新产品从指纹识别跨越到人脸识别后,大量厂商也在旗舰产品中加入了人脸解锁功能,虽然它们中的大部分没有激进到直接取消指纹键, ...

  9. Android 6.0 指纹识别功能学习(一)----阿冬专栏!!!

    转载自:http://www.cnblogs.com/changyuet/p/5535082.html 由于毕设需要设计增强的身份认证(生物特征认证方式),所以需要学习指纹识别相关的android6. ...

最新文章

  1. 深入理解 Event Loop
  2. 深入浅出计算机组成原理学习笔记:总线-计算机内部的高速公路(第42讲)
  3. mysql php gpl_MySQL_MySQL数据库远程访问权限如何打开(两种方法),下载GPL版本安装MySQL Community - phpStudy...
  4. 为什么二进制保存的文件,打开仍然可以正常显示
  5. PHP魔法函数性能分析
  6. oracle 12c dg新特性,Oracle 12c DG新特性---一键switchover
  7. 2019春第八周作业
  8. 使用maven工具无法进入debug
  9. Eclipse中不使用内嵌Maven
  10. 《统计学习方法》的Python 3.6复现,实测可用
  11. sync/atomic 库使用小结
  12. java汉字的编码_Java中文编码小结
  13. 计算机键盘上的每一个按键应用,电脑键盘按键都代表着什么意思?
  14. 【python】面向对象和正则表达式
  15. R语言差异检验:非参数检验
  16. 互联网公司的中台到底是什么
  17. 大地坐标转换极坐标(球坐标)
  18. 2018 11.1 PION 模拟赛
  19. hihocoder1383 The Book List 字典树
  20. WPF翻牌连连看(一)

热门文章

  1. webrtc媒体服务器介绍
  2. 《Kubernetes部署篇:基于docker使用kubespray工具部署高可用K8S集群(国内互联网方案四)》
  3. linux(manjaro)下安装jlink驱动
  4. idea中使用maven以后出现了程序包不存在的问题
  5. 文件操作的几种常用方式
  6. Linux Mint 18.1 下安装网易云音乐1.0
  7. java 取得webcontent_JAVA JSP WebContent
  8. 深入剖析在意大利肆掠的Danabot木马新变种
  9. js读取Excel的数据(仅IE有效)
  10. “新能源”担纲,IOT云端一体化,阿里集团CTO张建锋兼任阿里云CTO