检查逻辑

//是否支持指纹if (!fingerprintManager.isHardwareDetected()) {    return;}//权限if (ActivityCompat.checkSelfPermission(this, Manifest.permission.USE_FINGERPRINT) != PackageManager.PERMISSION_GRANTED) {    return;}//是否已经添加过指纹if (!fingerprintManager.hasEnrolledFingerprints()) {    return;}//是否有锁屏密码if (!keyguardManager.isKeyguardSecure()) {    return;}


与KeyStore配合使用


Key授权绑定

指纹跟锁屏密码强绑定

指纹没有锁屏码安全,所以操纵指纹需要锁屏码授权指纹能够被复制"a fingerprint may be less secure than a strong PIN, pattern, or password."(https://support.google.com/nexus/answer/6300638?hl=en)(需要知道指纹是谁的, 有指纹但没锁屏码->不知道是谁的指纹)操纵指纹需要锁屏码认证

锁屏密码:更安全(其他人无法增删改指纹), miui关闭锁屏密码不会删指纹

android支持的身份标识:锁屏码,指纹

Nexus-6P/Nexus-5X:关闭锁屏密码会删除所有指纹Miui:关闭锁屏密码不会删除指纹, 但下次打开锁屏密码时有保留指纹的确认


KeyPermanentlyInvalidatedException (Key失效)


使用流程

Request fingerprint authentication permission within the project's AndroidManifest file.Enable any lock screen security mechanism (PIN, pattern or password).Register at least one fingerprint on the device.Create an instance of the FingerprintManager.Use a Keystore instance to gain access to the Android Keystore container.Generate an encryption key using the KeyGenerator class and store it in the Keystore container.Initialise an instance of the Cipher class using the previously generated encryption key.Use the Cipher instance to create a CryptoObject and assign it to the instantiated FingerprintManager.Call the authenticate() method of the FingerprintManager instance.Handle callbacks on completion of a successful authentication, providing access to protected content or functionality.

更多相关文章

  1. android手机状态解释,比如android.os.Build.VERSION.SDK
  2. Android(安卓)全屏
  3. Android(安卓)发送通知 notification
  4. android需要的访问权限(不断更新,希望大家多交流)
  5. Android(安卓)解决Handler在运行时加载报空指针异常
  6. Android(安卓)Bluetooth 文件接收路径修改方法
  7. 获取android手机信息
  8. listview 左滑弹出删除按钮,需要折腾一下
  9. 获取Android的APK包签名信息

随机推荐

  1. Android利用Fiddler进行网络数据抓包
  2. Fragment生命周期详解
  3. 深入理解Android消息处理系统——Looper
  4. android JSONObject的使用
  5. 再论:如何解Bug
  6. 我对谷歌的chromium和android发展的看法
  7. Android音乐播放器【安卓进化二十】
  8. Android系列教程之六:TextView小组件的使
  9. Android大图片背景性能优化篇
  10. Android(安卓)Metro风格的Launcher开发系