mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-12-26 00:48:51 -05:00
Merge pull request #726 from mar-v-in/fix-import-from-server
Fix import from server
This commit is contained in:
commit
13a85e5702
@ -135,6 +135,9 @@ public class KeychainIntentService extends IntentService
|
|||||||
// delete file securely
|
// delete file securely
|
||||||
public static final String DELETE_FILE = "deleteFile";
|
public static final String DELETE_FILE = "deleteFile";
|
||||||
|
|
||||||
|
// import key
|
||||||
|
public static final String IMPORT_KEY_LIST = "import_key_list";
|
||||||
|
|
||||||
// export key
|
// export key
|
||||||
public static final String EXPORT_OUTPUT_STREAM = "export_output_stream";
|
public static final String EXPORT_OUTPUT_STREAM = "export_output_stream";
|
||||||
public static final String EXPORT_FILENAME = "export_filename";
|
public static final String EXPORT_FILENAME = "export_filename";
|
||||||
@ -384,9 +387,15 @@ public class KeychainIntentService extends IntentService
|
|||||||
}
|
}
|
||||||
} else if (ACTION_IMPORT_KEYRING.equals(action)) {
|
} else if (ACTION_IMPORT_KEYRING.equals(action)) {
|
||||||
try {
|
try {
|
||||||
|
List<ParcelableKeyRing> entries;
|
||||||
|
if (data.containsKey(IMPORT_KEY_LIST)) {
|
||||||
|
// get entries from intent
|
||||||
|
entries = data.getParcelableArrayList(IMPORT_KEY_LIST);
|
||||||
|
} else {
|
||||||
// get entries from cached file
|
// get entries from cached file
|
||||||
FileImportCache cache = new FileImportCache(this);
|
FileImportCache cache = new FileImportCache(this);
|
||||||
List<ParcelableKeyRing> entries = cache.readCache();
|
entries = cache.readCache();
|
||||||
|
}
|
||||||
|
|
||||||
PgpImportExport pgpImportExport = new PgpImportExport(this, this);
|
PgpImportExport pgpImportExport = new PgpImportExport(this, this);
|
||||||
ImportKeyResult result = pgpImportExport.importKeyRings(entries);
|
ImportKeyResult result = pgpImportExport.importKeyRings(entries);
|
||||||
@ -520,6 +529,8 @@ public class KeychainIntentService extends IntentService
|
|||||||
FileImportCache cache = new FileImportCache(this);
|
FileImportCache cache = new FileImportCache(this);
|
||||||
cache.writeCache(keyRings);
|
cache.writeCache(keyRings);
|
||||||
Bundle importData = new Bundle();
|
Bundle importData = new Bundle();
|
||||||
|
// This is not going through binder, nothing to fear of
|
||||||
|
importData.putParcelableArrayList(IMPORT_KEY_LIST, keyRings);
|
||||||
importIntent.putExtra(EXTRA_DATA, importData);
|
importIntent.putExtra(EXTRA_DATA, importData);
|
||||||
importIntent.putExtra(EXTRA_MESSENGER, mMessenger);
|
importIntent.putExtra(EXTRA_MESSENGER, mMessenger);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user