Better message view for fingerprint problem #114

This commit is contained in:
J-Jamet
2019-09-13 19:49:53 +02:00
parent 000277705a
commit b93d7bbf41
2 changed files with 14 additions and 7 deletions

View File

@@ -149,10 +149,12 @@ class BiometricUnlockDatabaseHelper(private val context: FragmentActivity,
return return
} }
try { try {
cipher?.init(Cipher.ENCRYPT_MODE, getSecretKey()) getSecretKey()?.let { secretKey ->
cipher?.init(Cipher.ENCRYPT_MODE, secretKey)
initBiometricPrompt() initBiometricPrompt()
actionIfCypherInit.invoke(biometricPrompt, cryptoObject, promptInfoStoreCredential) actionIfCypherInit.invoke(biometricPrompt, cryptoObject, promptInfoStoreCredential)
}
} catch (unrecoverableKeyException: UnrecoverableKeyException) { } catch (unrecoverableKeyException: UnrecoverableKeyException) {
Log.e(TAG, "Unable to initialize encrypt data", unrecoverableKeyException) Log.e(TAG, "Unable to initialize encrypt data", unrecoverableKeyException)
@@ -199,10 +201,13 @@ class BiometricUnlockDatabaseHelper(private val context: FragmentActivity,
// important to restore spec here that was used for decryption // important to restore spec here that was used for decryption
val iv = Base64.decode(ivSpecValue, Base64.NO_WRAP) val iv = Base64.decode(ivSpecValue, Base64.NO_WRAP)
val spec = IvParameterSpec(iv) val spec = IvParameterSpec(iv)
cipher?.init(Cipher.DECRYPT_MODE, getSecretKey(), spec)
initBiometricPrompt() getSecretKey()?.let { secretKey ->
actionIfCypherInit.invoke(biometricPrompt, cryptoObject, promptInfoExtractCredential) cipher?.init(Cipher.DECRYPT_MODE, secretKey, spec)
initBiometricPrompt()
actionIfCypherInit.invoke(biometricPrompt, cryptoObject, promptInfoExtractCredential)
}
} catch (unrecoverableKeyException: UnrecoverableKeyException) { } catch (unrecoverableKeyException: UnrecoverableKeyException) {
Log.e(TAG, "Unable to initialize decrypt data", unrecoverableKeyException) Log.e(TAG, "Unable to initialize decrypt data", unrecoverableKeyException)

View File

@@ -15,11 +15,13 @@
<LinearLayout <LinearLayout
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="0dp" android:layout_height="wrap_content"
android:layout_marginStart="24dp" android:layout_marginStart="24dp"
android:layout_marginEnd="18dp" android:layout_marginEnd="18dp"
android:orientation="vertical" android:orientation="vertical"
android:gravity="center_vertical" android:gravity="center_vertical"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
app:layout_constraintTop_toTopOf="@+id/biometric_delimiter" app:layout_constraintTop_toTopOf="@+id/biometric_delimiter"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"