fallback to "old" KeyStoreStorageService

This commit is contained in:
Kyle Spearrin 2017-06-08 20:37:44 -04:00
parent 6ddc7fa4cc
commit aff1cc1cc3

View file

@ -207,10 +207,23 @@ namespace Bit.Android
container.RegisterSingleton(application.ApplicationContext); container.RegisterSingleton(application.ApplicationContext);
container.RegisterSingleton<Application>(application); container.RegisterSingleton<Application>(application);
// Secure Storage
ISecureStorageService secureStorage;
try
{
secureStorage = new KeyStoreBackedStorageService(CrossSettings.Current);
}
catch
{
// Some isolated devices are having a hard time generating RSA keys for key store.
// Continue using the "old" keystore implementation for now.
secureStorage = new KeyStoreStorageService(new char[] { });
}
// Services // Services
container.RegisterSingleton<IDatabaseService, DatabaseService>(); container.RegisterSingleton<IDatabaseService, DatabaseService>();
container.RegisterSingleton<ISqlService, SqlService>(); container.RegisterSingleton<ISqlService, SqlService>();
container.RegisterSingleton<ISecureStorageService, KeyStoreBackedStorageService>(); container.RegisterSingleton(secureStorage);
container.RegisterSingleton<ICryptoService, CryptoService>(); container.RegisterSingleton<ICryptoService, CryptoService>();
container.RegisterSingleton<IKeyDerivationService, BouncyCastleKeyDerivationService>(); container.RegisterSingleton<IKeyDerivationService, BouncyCastleKeyDerivationService>();
container.RegisterSingleton<IAuthService, AuthService>(); container.RegisterSingleton<IAuthService, AuthService>();