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

@@ -130,7 +130,7 @@ public class NfcHelper {
try {
long masterKeyId = mDatabaseInteractor.getCachedPublicKeyRing(dataUri)
.extractOrGetMasterKeyId();
mNfcKeyringBytes = mDatabaseInteractor.getPublicKeyRingData(masterKeyId);
mNfcKeyringBytes = mDatabaseInteractor.loadPublicKeyRingData(masterKeyId);
} catch (NotFoundException | PgpKeyNotFoundException e) {
Log.e(Constants.TAG, "key not found!", e);
}

View File

@@ -52,6 +52,10 @@ public class ParcelableFileCache<E extends Parcelable> {
mFilename = filename;
}
public static boolean cacheFileExists(Context context, String filename) {
return new File(context.getCacheDir(), filename).exists();
}
public void writeCache(int numEntries, Iterator<E> it) throws IOException {
DataOutputStream oos = getOutputStream();