mirror of
https://github.com/bitwarden/android.git
synced 2024-12-24 18:08:26 +03:00
email crash report for key store service
This commit is contained in:
parent
07eabad18d
commit
a885e16049
1 changed files with 24 additions and 8 deletions
|
@ -11,6 +11,7 @@ using Android.Security.Keystore;
|
|||
using Android.App;
|
||||
using Plugin.Settings.Abstractions;
|
||||
using Java.Util;
|
||||
using Android.Content;
|
||||
|
||||
namespace Bit.Android.Services
|
||||
{
|
||||
|
@ -77,12 +78,13 @@ namespace Bit.Android.Services
|
|||
{
|
||||
return App.Utilities.Crypto.AesCbcDecrypt(new App.Models.CipherString(cs), aesKey);
|
||||
}
|
||||
catch
|
||||
catch(Exception e)
|
||||
{
|
||||
Console.WriteLine("Failed to decrypt from secure storage.");
|
||||
_settings.Remove(formattedKey);
|
||||
throw;
|
||||
//return null;
|
||||
//throw;
|
||||
SendEmail(e.Message + "\n\n" + e.StackTrace);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -107,10 +109,11 @@ namespace Bit.Android.Services
|
|||
var cipherString = App.Utilities.Crypto.AesCbcEncrypt(dataBytes, aesKey);
|
||||
_settings.AddOrUpdateValue(formattedKey, cipherString.EncryptedString);
|
||||
}
|
||||
catch
|
||||
catch(Exception e)
|
||||
{
|
||||
Console.WriteLine("Failed to encrypt to secure storage.");
|
||||
throw;
|
||||
SendEmail(e.Message + "\n\n" + e.StackTrace);
|
||||
//throw;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -187,13 +190,14 @@ namespace Bit.Android.Services
|
|||
var key = RsaDecrypt(encKeyBytes);
|
||||
return new App.Models.SymmetricCryptoKey(key);
|
||||
}
|
||||
catch
|
||||
catch(Exception e)
|
||||
{
|
||||
Console.WriteLine("Cannot get AesKey.");
|
||||
_keyStore.DeleteEntry(KeyAlias);
|
||||
_settings.Remove(AesKey);
|
||||
throw;
|
||||
//return null;
|
||||
//throw;
|
||||
SendEmail(e.Message + "\n\n" + e.StackTrace);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -239,5 +243,17 @@ namespace Bit.Android.Services
|
|||
_oldKeyStorageService.Delete(key);
|
||||
}
|
||||
}
|
||||
|
||||
private void SendEmail(string text)
|
||||
{
|
||||
var emailIntent = new Intent(Intent.ActionSend);
|
||||
|
||||
emailIntent.SetType("plain/text");
|
||||
emailIntent.PutExtra(Intent.ExtraEmail, new String[] { "hello@bitwarden.com" });
|
||||
emailIntent.PutExtra(Intent.ExtraSubject, "Crash Report");
|
||||
emailIntent.PutExtra(Intent.ExtraText, text);
|
||||
|
||||
Application.Context.StartActivity(Intent.CreateChooser(emailIntent, "Send mail..."));
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue