相关疑难解决方法(0)

密钥永久失效添加/删除指纹后的异常

当用户添加新指纹或删除任何现有指纹然后尝试启动应用程序时,它会抛出KeyPermanentlyInvalidatedException

这是我的指纹代码:

 public Boolean auth(FingerprintManager.AuthenticationCallback callback) {
    try {
        KeyStore store = accessKeyStore(DEFAULT_KEYSTORE);
        if (store == null) {
            return null;
        }

        Cipher cipher = accessCipher();
        if (cipher == null) {
            return null;
        }

        store.load(null);
        SecretKey key = (SecretKey) store.getKey(DEFAULT_KEY_NAME, DEFAULT_STORE_PASS.toCharArray());
        cipher.init(Cipher.ENCRYPT_MODE, key);

        FingerprintManager manager = initManager();
        if (manager == null) {
            return null;
        }

        manager.authenticate(
                generateCryptoObject(cipher),
                generateCancellationSignal(),
                0,
                callback,
                null
        );

        return true;
    } catch (Throwable exc) {
        Logger.error(TAG, exc.getLocalizedMessage(), exc);
        return null;
    }
}



private Cipher accessCipher() { …
Run Code Online (Sandbox Code Playgroud)

android android-fingerprint-api

1
推荐指数
1
解决办法
2998
查看次数

标签 统计

android ×1

android-fingerprint-api ×1