diff options
author | mar-v-in <github@rvin.mooo.com> | 2014-08-01 05:11:24 +0200 |
---|---|---|
committer | mar-v-in <github@rvin.mooo.com> | 2014-08-01 05:11:24 +0200 |
commit | 159c532ae2f36c666948dc2a01406bc2118b0029 (patch) | |
tree | 870adec282d15007a8c8f104315c0ef39b3d8fa0 /OpenKeychain/src/main/java/org/sufficientlysecure/keychain | |
parent | 50aea621ba4de844cf6eee077d1f5b14d0247f14 (diff) | |
download | open-keychain-159c532ae2f36c666948dc2a01406bc2118b0029.tar.gz open-keychain-159c532ae2f36c666948dc2a01406bc2118b0029.tar.bz2 open-keychain-159c532ae2f36c666948dc2a01406bc2118b0029.zip |
Fix import from server
Was broken since 7bbe869c88c445b087e32a75572cf18efa2165b6
This also keeps the ACTION_IMPORT_KEYRING action stable
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain')
-rw-r--r-- | OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java | 47 |
1 files changed, 17 insertions, 30 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java index 57152c36d..3b5293e75 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java @@ -25,29 +25,13 @@ import android.os.Bundle; import android.os.Message; import android.os.Messenger; import android.os.RemoteException; - import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.helper.FileHelper; import org.sufficientlysecure.keychain.helper.OtherHelper; import org.sufficientlysecure.keychain.helper.Preferences; -import org.sufficientlysecure.keychain.keyimport.FileImportCache; -import org.sufficientlysecure.keychain.keyimport.HkpKeyserver; -import org.sufficientlysecure.keychain.keyimport.ImportKeysListEntry; -import org.sufficientlysecure.keychain.keyimport.KeybaseKeyserver; -import org.sufficientlysecure.keychain.keyimport.Keyserver; -import org.sufficientlysecure.keychain.keyimport.ParcelableKeyRing; -import org.sufficientlysecure.keychain.pgp.CanonicalizedPublicKeyRing; -import org.sufficientlysecure.keychain.pgp.CanonicalizedSecretKey; -import org.sufficientlysecure.keychain.pgp.CanonicalizedSecretKeyRing; -import org.sufficientlysecure.keychain.pgp.PgpDecryptVerify; -import org.sufficientlysecure.keychain.pgp.PgpDecryptVerifyResult; -import org.sufficientlysecure.keychain.pgp.PgpHelper; -import org.sufficientlysecure.keychain.pgp.PgpImportExport; -import org.sufficientlysecure.keychain.pgp.PgpKeyOperation; -import org.sufficientlysecure.keychain.pgp.PgpSignEncrypt; -import org.sufficientlysecure.keychain.pgp.Progressable; -import org.sufficientlysecure.keychain.pgp.UncachedKeyRing; +import org.sufficientlysecure.keychain.keyimport.*; +import org.sufficientlysecure.keychain.pgp.*; import org.sufficientlysecure.keychain.pgp.exception.PgpGeneralException; import org.sufficientlysecure.keychain.pgp.exception.PgpGeneralMsgIdException; import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings; @@ -59,15 +43,7 @@ import org.sufficientlysecure.keychain.util.InputData; import org.sufficientlysecure.keychain.util.Log; import org.sufficientlysecure.keychain.util.ProgressScaler; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; +import java.io.*; import java.util.ArrayList; import java.util.List; @@ -135,6 +111,9 @@ public class KeychainIntentService extends IntentService // delete file securely public static final String DELETE_FILE = "deleteFile"; + // import key + public static final String IMPORT_KEY_LIST = "import_key_list"; + // export key public static final String EXPORT_OUTPUT_STREAM = "export_output_stream"; public static final String EXPORT_FILENAME = "export_filename"; @@ -384,9 +363,15 @@ public class KeychainIntentService extends IntentService } } else if (ACTION_IMPORT_KEYRING.equals(action)) { try { - // get entries from cached file - FileImportCache cache = new FileImportCache(this); - List<ParcelableKeyRing> entries = cache.readCache(); + 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 + FileImportCache cache = new FileImportCache(this); + entries = cache.readCache(); + } PgpImportExport pgpImportExport = new PgpImportExport(this, this); ImportKeyResult result = pgpImportExport.importKeyRings(entries); @@ -515,6 +500,8 @@ public class KeychainIntentService extends IntentService Intent importIntent = new Intent(this, KeychainIntentService.class); importIntent.setAction(ACTION_IMPORT_KEYRING); 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_MESSENGER, mMessenger); |