diff --git a/src/Android/Android.csproj b/src/Android/Android.csproj
index 4961d30d2..4f10b70dc 100644
--- a/src/Android/Android.csproj
+++ b/src/Android/Android.csproj
@@ -313,7 +313,6 @@
-
diff --git a/src/Android/Services/AndroidKeyStoreStorageService.cs b/src/Android/Services/AndroidKeyStoreStorageService.cs
index b2944e491..b082601dd 100644
--- a/src/Android/Services/AndroidKeyStoreStorageService.cs
+++ b/src/Android/Services/AndroidKeyStoreStorageService.cs
@@ -33,14 +33,12 @@ namespace Bit.Android.Services
private readonly bool _oldAndroid;
private readonly ISettings _settings;
private readonly KeyStore _keyStore;
- private readonly ISecureStorageService _oldKeyStorageService;
public AndroidKeyStoreStorageService(ISettings settings)
{
_oldAndroid = Build.VERSION.SdkInt < BuildVersionCodes.M;
_rsaMode = _oldAndroid ? "RSA/ECB/PKCS1Padding" : "RSA/ECB/OAEPWithSHA-1AndMGF1Padding";
- _oldKeyStorageService = new KeyStoreStorageService(new char[] { });
_settings = settings;
_keyStore = KeyStore.GetInstance(AndroidKeyStore);
@@ -53,8 +51,7 @@ namespace Bit.Android.Services
public bool Contains(string key)
{
return _settings.Contains(string.Format(SettingsFormat, key)) ||
- _settings.Contains(string.Format(SettingsFormatV1, key)) ||
- _oldKeyStorageService.Contains(key);
+ _settings.Contains(string.Format(SettingsFormatV1, key));
}
public void Delete(string key)
@@ -297,13 +294,6 @@ namespace Bit.Android.Services
private byte[] TryGetAndMigrate(string key)
{
- if(_oldKeyStorageService.Contains(key))
- {
- var value = _oldKeyStorageService.Retrieve(key);
- Store(key, value);
- return value;
- }
-
var formattedKeyV1 = string.Format(SettingsFormatV1, key);
if(_settings.Contains(formattedKeyV1))
{
@@ -331,11 +321,6 @@ namespace Bit.Android.Services
private void CleanupOld(string key)
{
- if(_oldKeyStorageService.Contains(key))
- {
- _oldKeyStorageService.Delete(key);
- }
-
var formattedKeyV1 = string.Format(SettingsFormatV1, key);
if(_settings.Contains(formattedKeyV1))
{
diff --git a/src/Android/Services/KeyStoreStorageService.cs b/src/Android/Services/KeyStoreStorageService.cs
deleted file mode 100644
index 98806e626..000000000
--- a/src/Android/Services/KeyStoreStorageService.cs
+++ /dev/null
@@ -1,113 +0,0 @@
-using System.IO;
-using System.IO.IsolatedStorage;
-using Java.Lang;
-using Java.Security;
-using Javax.Crypto;
-using Android.OS;
-using Bit.App.Abstractions;
-
-namespace Bit.Android.Services
-{
- [System.Obsolete]
- public class KeyStoreStorageService : ISecureStorageService
- {
- private const string StorageFile = "Bit.Android.KeyStoreStorageService";
-
- private static readonly object SaveLock = new object();
-
- private readonly KeyStore _keyStore;
- private readonly KeyStore.PasswordProtection _protection;
-
- public KeyStoreStorageService()
- : this(Build.Serial.ToCharArray()) { }
-
- public KeyStoreStorageService(char[] password)
- {
- _keyStore = KeyStore.GetInstance(KeyStore.DefaultType);
- _protection = new KeyStore.PasswordProtection(password);
-
- if(File.FileExists(StorageFile))
- {
- using(var stream = new IsolatedStorageFileStream(StorageFile, FileMode.Open, FileAccess.Read, File))
- {
- _keyStore.Load(stream, password);
- }
- }
- else
- {
- _keyStore.Load(null, password);
- }
- }
-
- private static IsolatedStorageFile File
- {
- get { return IsolatedStorageFile.GetUserStoreForApplication(); }
- }
-
- public void Store(string key, byte[] dataBytes)
- {
- _keyStore.SetEntry(key, new KeyStore.SecretKeyEntry(new SecureData(dataBytes)), _protection);
- Save();
- }
-
- public byte[] Retrieve(string key)
- {
- var entry = _keyStore.GetEntry(key, _protection) as KeyStore.SecretKeyEntry;
- if(entry == null)
- {
- return null;
- }
-
- return entry.SecretKey.GetEncoded();
- }
-
- public void Delete(string key)
- {
- _keyStore.DeleteEntry(key);
- Save();
- }
-
- public bool Contains(string key)
- {
- return _keyStore.ContainsAlias(key);
- }
-
- private void Save()
- {
- lock(SaveLock)
- {
- using(var stream = new IsolatedStorageFileStream(StorageFile, FileMode.OpenOrCreate, FileAccess.Write, File))
- {
- _keyStore.Store(stream, _protection.GetPassword());
- }
- }
- }
-
- private class SecureData : Object, ISecretKey
- {
- private const string Raw = "RAW";
-
- private readonly byte[] _data;
-
- public SecureData(byte[] dataBytes)
- {
- _data = dataBytes;
- }
-
- public string Algorithm
- {
- get { return Raw; }
- }
-
- public string Format
- {
- get { return Raw; }
- }
-
- public byte[] GetEncoded()
- {
- return _data;
- }
- }
- }
-}
\ No newline at end of file