add LocalKeyStorage, don't store public keys larger than 50kb in database

This commit is contained in:
Vincent Breitmoser
2017-02-24 17:25:32 +01:00
parent 2bc05a2cd5
commit c7e01926e1
44 changed files with 314 additions and 150 deletions

View File

@@ -111,7 +111,8 @@ public class KeychainService extends Service implements Progressable {
// just for brevity
KeychainService outerThis = KeychainService.this;
DatabaseReadWriteInteractor databaseInteractor = new DatabaseReadWriteInteractor(outerThis);
DatabaseReadWriteInteractor databaseInteractor =
DatabaseReadWriteInteractor.createDatabaseReadWriteInteractor(outerThis);
if (inputParcel instanceof SignEncryptParcel) {
op = new SignEncryptOperation(outerThis, databaseInteractor, outerThis, mActionCanceled);
} else if (inputParcel instanceof PgpDecryptVerifyInputParcel) {

View File

@@ -321,7 +321,8 @@ public class KeyserverSyncAdapterService extends Service {
private ImportKeyResult directUpdate(Context context, ArrayList<ParcelableKeyRing> keyList,
CryptoInputParcel cryptoInputParcel) {
Log.d(Constants.TAG, "Starting normal update");
ImportOperation importOp = new ImportOperation(context, new DatabaseReadWriteInteractor(context), null);
ImportOperation importOp = new ImportOperation(context,
DatabaseReadWriteInteractor.createDatabaseReadWriteInteractor(context), null);
return importOp.execute(
new ImportKeyringParcel(keyList,
Preferences.getPreferences(context).getPreferredKeyserver()),
@@ -381,7 +382,7 @@ public class KeyserverSyncAdapterService extends Service {
new OperationResult.OperationLog());
}
ImportKeyResult result =
new ImportOperation(context, new DatabaseReadWriteInteractor(context), null, mCancelled)
new ImportOperation(context, DatabaseReadWriteInteractor.createDatabaseReadWriteInteractor(context), null, mCancelled)
.execute(
new ImportKeyringParcel(
keyWrapper,

View File

@@ -245,7 +245,7 @@ public class PassphraseCacheService extends Service {
+ masterKeyId + ", subKeyId " + subKeyId);
// get the type of key (from the database)
CachedPublicKeyRing keyRing = new DatabaseInteractor(getContentResolver()).getCachedPublicKeyRing(masterKeyId);
CachedPublicKeyRing keyRing = DatabaseInteractor.createDatabaseInteractor(this).getCachedPublicKeyRing(masterKeyId);
SecretKeyType keyType = keyRing.getSecretKeyType(subKeyId);
switch (keyType) {