检查逻辑

//是否支持指纹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 Service绑定的时候没有回调onBound函数
  2. 【Android】Activity与服务Service绑定
  3. Android 带密码输入界面的Dialog实现机制
  4. [图解]Android源码分析——Service的启动和绑定过程
  5. android默认debug.keystore的密码
  6. Android动态显示隐藏密码输入框的内容
  7. 命令获取 Eclipse Android 证书指纹 MD5、SHA1
  8. Android EditText 密码输入框可见性设置
  9. Android:week 13总结 绑定服务、音乐播放器(服务)

随机推荐

  1. Day2.3--Android常用布局之RelativeLayou
  2. 自定义Logcat,完全控制打印信息
  3. JNI 引用问题梳理
  4. Android(安卓)vector 标签 pathData
  5. Android(安卓)ContentProvider的实现及简
  6. Article 2017- Q1
  7. Android(安卓)快速开发框架:推荐10个框架
  8. OpenCore代码阅读--PVPlayer的实现
  9. Android实时视频采集方案
  10. 【Android(安卓)Studio】制作启动画面Spl