fingerprintlib/src/main/java/com/lib/lock/fingerprint/core/CryptoObjectCreator.java
/**
     * Creates a symmetric key in the Android Key Store which can only be used after the user has
     * authenticated with fingerprint.
     */
Creates a symmetric key in the Android Key Store which can only be used after the user has
authenticated with fingerprint.
Creates a symmetric key in the Android Key Store which can only be used after the user has authenticated with fingerprint .
private void createKey() {
        try {
            mKeyStore.load(null);
            mKeyGenerator.init(new KeyGenParameterSpec.Builder(KEY_NAME,
                    KeyProperties.PURPOSE_ENCRYPT |
                            KeyProperties.PURPOSE_DECRYPT)
                    .setBlockModes(KeyProperties.BLOCK_MODE_CBC)
                    .setUserAuthenticationRequired(true)
                    .setEncryptionPaddings(KeyProperties.ENCRYPTION_PADDING_PKCS7)
                    .build());
            mKeyGenerator.generateKey();
        } catch (NoSuchAlgorithmException | InvalidAlgorithmParameterException
                | CertificateException | IOException e) {
            Log.e(""," Failed to createKey, e:");
            throw new RuntimeException(e);
        }
    }
private void createKey ( ) { try { mKeyStore . load ( null ) ; mKeyGenerator . init ( new KeyGenParameterSpec . Builder ( KEY_NAME , KeyProperties . PURPOSE_ENCRYPT | KeyProperties . PURPOSE_DECRYPT ) . setBlockModes ( KeyProperties . BLOCK_MODE_CBC ) . setUserAuthenticationRequired ( true ) . setEncryptionPaddings ( KeyProperties . ENCRYPTION_PADDING_PKCS7 ) . build ( ) ) ; mKeyGenerator . generateKey ( ) ; } catch ( NoSuchAlgorithmException | InvalidAlgorithmParameterException | CertificateException | IOException e ) { Log . e ( "" , " Failed to createKey, e:" ) ; throw new RuntimeException ( e ) ; } }
Creates a symmetric key in the Android Key Store which can only be used after the user has
 authenticated with fingerprint.
Creates a symmetric key in the Android Key Store which can only be used after the user has authenticated with fingerprint .
// The enrolling flow for fingerprint. This is where you ask the user to set up fingerprint // for your flow. Use of keys is necessary if you need to know if the set of // enrolled fingerprints has changed. // Set the alias of the entry in Android KeyStore where the key will appear // and the constrains (purposes) in the constructor of the Builder // Require the user to authenticate with a fingerprint to authorize every use // of the key