android的指纹问题

检查逻辑

//是否支持指纹
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.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值