avoid crash when ROM does not support fingerprint encryption, closes https://github.com/PhilippC/keepass2android/issues/155
This commit is contained in:
@@ -227,7 +227,7 @@ namespace keepass2android
|
||||
public string Encrypt(string textToEncrypt)
|
||||
{
|
||||
Kp2aLog.Log("FP: Encrypting");
|
||||
return Base64.EncodeToString(_cipher.DoFinal(System.Text.Encoding.UTF8.GetBytes(textToEncrypt)), 0);
|
||||
return Base64.EncodeToString(_cipher.DoFinal(System.Text.Encoding.UTF8.GetBytes(textToEncrypt)), 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -186,14 +186,28 @@ namespace keepass2android
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_unlockMode == FingerprintUnlockMode.FullUnlock)
|
||||
{
|
||||
var userKey = App.Kp2a.CurrentDb.KpDatabase.MasterKey.GetUserKey<KcpPassword>();
|
||||
_enc.StoreEncrypted(userKey != null ? userKey.Password.ReadString() : "", CurrentPreferenceKey, edit);
|
||||
}
|
||||
else
|
||||
_enc.StoreEncrypted("QuickUnlock" /*some dummy data*/, CurrentPreferenceKey, edit);
|
||||
}
|
||||
try
|
||||
{
|
||||
if (_unlockMode == FingerprintUnlockMode.FullUnlock)
|
||||
{
|
||||
var userKey = App.Kp2a.CurrentDb.KpDatabase.MasterKey.GetUserKey<KcpPassword>();
|
||||
_enc.StoreEncrypted(userKey != null ? userKey.Password.ReadString() : "", CurrentPreferenceKey, edit);
|
||||
}
|
||||
else
|
||||
_enc.StoreEncrypted("QuickUnlock" /*some dummy data*/, CurrentPreferenceKey, edit);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
new AlertDialog.Builder(this)
|
||||
.SetTitle(GetString(Resource.String.ErrorOcurred))
|
||||
.SetMessage(GetString(Resource.String.FingerprintSetupFailed))
|
||||
.SetCancelable(false)
|
||||
.SetPositiveButton(Android.Resource.String.Ok, (sender, args) => { })
|
||||
.Show();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
edit.PutString(App.Kp2a.CurrentDb.CurrentFingerprintModePrefKey, _unlockMode.ToString());
|
||||
edit.Commit();
|
||||
}
|
||||
|
||||
@@ -105,6 +105,7 @@
|
||||
<string name="fingerprint_reenable">Please re-enable Fingerprint Unlock for the new master password.</string>
|
||||
<string name="fingerprint_reenable2">Please unlock with your password and then re-enable Fingerprint Unlock in the database settings.</string>
|
||||
<string name="FingerprintInitFailed">Failed to initialize fingerprint sensor. </string>
|
||||
<string name="FingerprintSetupFailed">Failed to encrypt data. This can happen if you add or remove fingerprints in the system settings while Keepass2Android is listening for your fingerprint.</string>
|
||||
|
||||
|
||||
<string name="enable_fingerprint_unlock_Info">This will store your master password on this device, encrypted with the Android Keystore and protected using fingerprint authentication. Allows to unlock your database only with your fingerprint.</string>
|
||||
@@ -744,6 +745,7 @@
|
||||
<string name="configure_child_dbs">Configure child databases…</string>
|
||||
<string name="child_dbs_title">Child databases</string>
|
||||
<string name="unspecified">unspecified</string>
|
||||
<string name="child_db_explanation">Child databases are other databases which can be opened automatically when you open the parent database. Therefore, the child\'s master password and file location are stored in the parent. This feature allows to share some of your passwords with another person. The implementation is compatible with KeeAutoExec for PC.</string>
|
||||
|
||||
<string name="child_db_enabled_on_this_device">Enabled on this device</string>
|
||||
<string name="child_db_enable_on_this_device">Enable on this device</string>
|
||||
@@ -782,7 +784,7 @@
|
||||
<string name="ChangeLog_1_07">
|
||||
Version 1.07-pre\n
|
||||
* Fixes for crashes on Samsung\'s Android 9\n
|
||||
* Allow to open more than one database, compatible to KeeAutoExec\n
|
||||
* Allow to open more than one database, compatible with KeeAutoExec\n
|
||||
* SFTP: Allow public key authentication, check if host key changed\n
|
||||
* Introduce pCloud support - thanks to gilbsgilbs!\n
|
||||
* Make Nextcloud support explicit\n
|
||||
|
||||
Reference in New Issue
Block a user