Select pub key when email could not be found

This commit is contained in:
Dominik Schürmann
2013-09-08 17:04:33 +02:00
parent 6fdae001cc
commit 4d1d3f6f5e
8 changed files with 159 additions and 89 deletions

View File

@@ -1,56 +1,59 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" > android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Encrypt UserIds (split with &apos;,&apos;)"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="@+id/crypto_provider_demo_encrypt_user_id"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="dominik@dominikschuermann.de"
android:textAppearance="@android:style/TextAppearance.Small" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Message"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="@+id/crypto_provider_demo_message"
android:layout_width="match_parent"
android:layout_height="150dip"
android:scrollHorizontally="true"
android:scrollbars="vertical"
android:text="message"
android:textAppearance="@android:style/TextAppearance.Small" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Ciphertext"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="@+id/crypto_provider_demo_ciphertext"
android:layout_width="match_parent"
android:layout_height="150dip"
android:text="ciphertext"
android:textAppearance="@android:style/TextAppearance.Small" />
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="wrap_content" >
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Encrypt User Id"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="@+id/crypto_provider_demo_encrypt_user_id"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="dominik@dominikschuermann.de"
android:textAppearance="@android:style/TextAppearance.Small" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Message"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="@+id/crypto_provider_demo_message"
android:layout_width="match_parent"
android:layout_height="150dip"
android:text="message"
android:textAppearance="@android:style/TextAppearance.Small" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Ciphertext"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="@+id/crypto_provider_demo_ciphertext"
android:layout_width="match_parent"
android:layout_height="150dip"
android:text="ciphertext"
android:textAppearance="@android:style/TextAppearance.Small" />
<Button <Button
android:id="@+id/crypto_provider_demo_encrypt" android:id="@+id/crypto_provider_demo_encrypt"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1"
android:onClick="encryptOnClick" android:onClick="encryptOnClick"
android:text="Encrypt" /> android:text="Encrypt" />
@@ -58,6 +61,7 @@
android:id="@+id/crypto_provider_demo_sign" android:id="@+id/crypto_provider_demo_sign"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1"
android:onClick="signOnClick" android:onClick="signOnClick"
android:text="Sign" /> android:text="Sign" />
@@ -65,6 +69,7 @@
android:id="@+id/crypto_provider_demo_encrypt_and_sign" android:id="@+id/crypto_provider_demo_encrypt_and_sign"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1"
android:onClick="encryptAndSignOnClick" android:onClick="encryptAndSignOnClick"
android:text="Encrypt and Sign" /> android:text="Encrypt and Sign" />
@@ -72,8 +77,9 @@
android:id="@+id/crypto_provider_demo_decrypt" android:id="@+id/crypto_provider_demo_decrypt"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1"
android:onClick="decryptOnClick" android:onClick="decryptOnClick"
android:text="Decrypt" /> android:text="Decrypt" />
</LinearLayout> </LinearLayout>
</ScrollView> </LinearLayout>

View File

@@ -35,12 +35,14 @@ import android.content.pm.ResolveInfo;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.Bundle; import android.os.Bundle;
import android.os.RemoteException; import android.os.RemoteException;
import android.text.method.ScrollingMovementMethod;
import android.util.Log; import android.util.Log;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import android.widget.EditText; import android.widget.EditText;
import android.widget.ListAdapter; import android.widget.ListAdapter;
import android.widget.Scroller;
import android.widget.TextView; import android.widget.TextView;
public class CryptoProviderDemoActivity extends Activity { public class CryptoProviderDemoActivity extends Activity {
@@ -48,7 +50,7 @@ public class CryptoProviderDemoActivity extends Activity {
EditText mMessage; EditText mMessage;
EditText mCiphertext; EditText mCiphertext;
EditText mEncryptUserId; EditText mEncryptUserIds;
private CryptoServiceConnection mCryptoServiceConnection; private CryptoServiceConnection mCryptoServiceConnection;
@@ -61,7 +63,7 @@ public class CryptoProviderDemoActivity extends Activity {
mMessage = (EditText) findViewById(R.id.crypto_provider_demo_message); mMessage = (EditText) findViewById(R.id.crypto_provider_demo_message);
mCiphertext = (EditText) findViewById(R.id.crypto_provider_demo_ciphertext); mCiphertext = (EditText) findViewById(R.id.crypto_provider_demo_ciphertext);
mEncryptUserId = (EditText) findViewById(R.id.crypto_provider_demo_encrypt_user_id); mEncryptUserIds = (EditText) findViewById(R.id.crypto_provider_demo_encrypt_user_id);
selectCryptoProvider(); selectCryptoProvider();
} }
@@ -125,7 +127,7 @@ public class CryptoProviderDemoActivity extends Activity {
try { try {
mCryptoServiceConnection.getService().encrypt(inputBytes, mCryptoServiceConnection.getService().encrypt(inputBytes,
new String[] { mEncryptUserId.getText().toString() }, encryptCallback); mEncryptUserIds.getText().toString().split(","), encryptCallback);
} catch (RemoteException e) { } catch (RemoteException e) {
Log.e(Constants.TAG, "CryptoProviderDemo", e); Log.e(Constants.TAG, "CryptoProviderDemo", e);
} }
@@ -146,7 +148,7 @@ public class CryptoProviderDemoActivity extends Activity {
try { try {
mCryptoServiceConnection.getService().encryptAndSign(inputBytes, mCryptoServiceConnection.getService().encryptAndSign(inputBytes,
new String[] { mEncryptUserId.getText().toString() }, encryptCallback); mEncryptUserIds.getText().toString().split(","), encryptCallback);
} catch (RemoteException e) { } catch (RemoteException e) {
Log.e(Constants.TAG, "CryptoProviderDemo", e); Log.e(Constants.TAG, "CryptoProviderDemo", e);
} }

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/api_select_pub_keys_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="8dp"
android:paddingBottom="3dip"
android:text="@string/api_select_pub_keys_text"
android:textAppearance="?android:attr/textAppearanceLarge" />
<FrameLayout
android:id="@+id/api_select_pub_keys_fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>

View File

@@ -329,12 +329,12 @@
<string name="key_size_1024">1024</string> <string name="key_size_1024">1024</string>
<string name="key_size_2048">2048</string> <string name="key_size_2048">2048</string>
<string name="key_size_4096">4096</string> <string name="key_size_4096">4096</string>
<!-- misc --> <!-- misc -->
<string name="fast">fast</string> <string name="fast">fast</string>
<string name="slow">slow</string> <string name="slow">slow</string>
<string name="very_slow">very slow</string> <string name="very_slow">very slow</string>
<!-- APG 2.0 --> <!-- APG 2.0 -->
@@ -377,5 +377,6 @@
<string name="api_register_allow">Allow access</string> <string name="api_register_allow">Allow access</string>
<string name="api_register_disallow">Disallow access</string> <string name="api_register_disallow">Disallow access</string>
<string name="api_register_error_select_key">Please select a key!</string> <string name="api_register_error_select_key">Please select a key!</string>
<string name="api_select_pub_keys_text">You have selected recipients (e.g. by selecting email addresses), which public keys could not be found. Please verify your selection!</string>
</resources>
</resources>

View File

@@ -735,14 +735,14 @@ public class PgpMain {
*/ */
public static void encryptAndSign(Context context, ProgressDialogUpdater progress, public static void encryptAndSign(Context context, ProgressDialogUpdater progress,
InputData data, OutputStream outStream, boolean useAsciiArmor, int compression, InputData data, OutputStream outStream, boolean useAsciiArmor, int compression,
ArrayList<Long> encryptionKeyIds, String encryptionPassphrase, long[] encryptionKeyIds, String encryptionPassphrase,
int symmetricEncryptionAlgorithm, long signatureKeyId, int signatureHashAlgorithm, int symmetricEncryptionAlgorithm, long signatureKeyId, int signatureHashAlgorithm,
boolean signatureForceV3, String signaturePassphrase) throws IOException, boolean signatureForceV3, String signaturePassphrase) throws IOException,
PgpGeneralException, PGPException, NoSuchProviderException, NoSuchAlgorithmException, PgpGeneralException, PGPException, NoSuchProviderException, NoSuchAlgorithmException,
SignatureException { SignatureException {
if (encryptionKeyIds == null) { if (encryptionKeyIds == null) {
encryptionKeyIds = new ArrayList<Long>(); encryptionKeyIds = new long[0];
} }
ArmoredOutputStream armorOut = null; ArmoredOutputStream armorOut = null;
@@ -759,7 +759,7 @@ public class PgpMain {
PGPSecretKeyRing signingKeyRing = null; PGPSecretKeyRing signingKeyRing = null;
PGPPrivateKey signaturePrivateKey = null; PGPPrivateKey signaturePrivateKey = null;
if (encryptionKeyIds.size() == 0 && encryptionPassphrase == null) { if (encryptionKeyIds.length == 0 && encryptionPassphrase == null) {
throw new PgpGeneralException( throw new PgpGeneralException(
context.getString(R.string.error_noEncryptionKeysOrPassPhrase)); context.getString(R.string.error_noEncryptionKeysOrPassPhrase));
} }
@@ -795,7 +795,7 @@ public class PgpMain {
PGPEncryptedDataGenerator cPk = new PGPEncryptedDataGenerator(encryptorBuilder); PGPEncryptedDataGenerator cPk = new PGPEncryptedDataGenerator(encryptorBuilder);
if (encryptionKeyIds.size() == 0) { if (encryptionKeyIds.length == 0) {
// Symmetric encryption // Symmetric encryption
Log.d(Constants.TAG, "encryptionKeyIds length is 0 -> symmetric encryption"); Log.d(Constants.TAG, "encryptionKeyIds length is 0 -> symmetric encryption");

View File

@@ -112,7 +112,7 @@ public class CryptoService extends Service {
* @param encryptionUserIds * @param encryptionUserIds
* @return * @return
*/ */
private ArrayList<Long> getKeyIdsFromEmails(String[] encryptionUserIds) { private long[] getKeyIdsFromEmails(String[] encryptionUserIds, long ownKeyId) {
// find key ids to given emails in database // find key ids to given emails in database
boolean manySameUserIds = false; boolean manySameUserIds = false;
boolean missingUserIds = false; boolean missingUserIds = false;
@@ -133,9 +133,22 @@ public class CryptoService extends Service {
} }
} }
// TODO: show selection activity on missingUserIds or manySameUserIds // also encrypt to our self (so that we can decrypt it later!)
keyIds.add(ownKeyId);
return keyIds; // convert o long[]
long[] keyIdsArray = new long[keyIds.size()];
for (int i = 0; i < keyIdsArray.length; i++) {
keyIdsArray[i] = keyIds.get(i);
}
if (missingUserIds || manySameUserIds) {
Bundle extras = new Bundle();
extras.putLongArray(CryptoServiceActivity.EXTRA_SELECTED_MASTER_KEY_IDS, keyIdsArray);
pauseQueueAndStartServiceActivity(CryptoServiceActivity.ACTION_SELECT_PUB_KEYS, extras);
}
return keyIdsArray;
} }
private synchronized void encryptAndSignSafe(byte[] inputBytes, String[] encryptionUserIds, private synchronized void encryptAndSignSafe(byte[] inputBytes, String[] encryptionUserIds,
@@ -154,10 +167,7 @@ public class CryptoService extends Service {
OutputStream outputStream = new ByteArrayOutputStream(); OutputStream outputStream = new ByteArrayOutputStream();
ArrayList<Long> keyIds = getKeyIdsFromEmails(encryptionUserIds); long[] keyIds = getKeyIdsFromEmails(encryptionUserIds, appSettings.getKeyId());
// also encrypt to our self (so that we can decrypt it later!)
keyIds.add(appSettings.getKeyId());
if (sign) { if (sign) {
PgpMain.encryptAndSign(mContext, null, inputData, outputStream, PgpMain.encryptAndSign(mContext, null, inputData, outputStream,
@@ -384,7 +394,7 @@ public class CryptoService extends Service {
@Override @Override
public void onSelectedPublicKeys(long[] keyIds) throws RemoteException { public void onSelectedPublicKeys(long[] keyIds) throws RemoteException {
// TODO Auto-generated method stub // TODO Auto-generated method stub
} }
}; };

View File

@@ -21,9 +21,9 @@ import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.Id; import org.sufficientlysecure.keychain.Id;
import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.helper.ActionBarHelper; import org.sufficientlysecure.keychain.helper.ActionBarHelper;
import org.sufficientlysecure.keychain.helper.OtherHelper;
import org.sufficientlysecure.keychain.helper.PgpMain; import org.sufficientlysecure.keychain.helper.PgpMain;
import org.sufficientlysecure.keychain.provider.ProviderHelper; import org.sufficientlysecure.keychain.provider.ProviderHelper;
import org.sufficientlysecure.keychain.ui.SelectPublicKeyFragment;
import org.sufficientlysecure.keychain.ui.dialog.PassphraseDialogFragment; import org.sufficientlysecure.keychain.ui.dialog.PassphraseDialogFragment;
import org.sufficientlysecure.keychain.util.Log; import org.sufficientlysecure.keychain.util.Log;
@@ -37,13 +37,9 @@ import android.os.IBinder;
import android.os.Message; import android.os.Message;
import android.os.Messenger; import android.os.Messenger;
import android.os.RemoteException; import android.os.RemoteException;
import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.app.SherlockFragmentActivity; import com.actionbarsherlock.app.SherlockFragmentActivity;
public class CryptoServiceActivity extends SherlockFragmentActivity { public class CryptoServiceActivity extends SherlockFragmentActivity {
@@ -56,12 +52,15 @@ public class CryptoServiceActivity extends SherlockFragmentActivity {
public static final String EXTRA_SECRET_KEY_ID = "secretKeyId"; public static final String EXTRA_SECRET_KEY_ID = "secretKeyId";
public static final String EXTRA_PACKAGE_NAME = "packageName"; public static final String EXTRA_PACKAGE_NAME = "packageName";
public static final String EXTRA_SELECTED_MASTER_KEY_IDS = "masterKeyIds";
private IServiceActivityCallback mServiceCallback; private IServiceActivityCallback mServiceCallback;
private boolean mServiceBound; private boolean mServiceBound;
// register view // register view
AppSettingsFragment settingsFragment; AppSettingsFragment mSettingsFragment;
// select pub key view
SelectPublicKeyFragment mSelectFragment;
private ServiceConnection mServiceActivityConnection = new ServiceConnection() { private ServiceConnection mServiceActivityConnection = new ServiceConnection() {
public void onServiceConnected(ComponentName name, IBinder service) { public void onServiceConnected(ComponentName name, IBinder service) {
@@ -116,7 +115,7 @@ public class CryptoServiceActivity extends SherlockFragmentActivity {
// bind to our own crypto service // bind to our own crypto service
bindToService(); bindToService();
handleActions(getIntent()); handleActions(getIntent(), savedInstanceState);
} }
@Override @Override
@@ -129,7 +128,7 @@ public class CryptoServiceActivity extends SherlockFragmentActivity {
} }
} }
protected void handleActions(Intent intent) { protected void handleActions(Intent intent, Bundle savedInstanceState) {
String action = intent.getAction(); String action = intent.getAction();
Bundle extras = intent.getExtras(); Bundle extras = intent.getExtras();
@@ -151,13 +150,13 @@ public class CryptoServiceActivity extends SherlockFragmentActivity {
// Allow // Allow
// user needs to select a key! // user needs to select a key!
if (settingsFragment.getAppSettings().getKeyId() == Id.key.none) { if (mSettingsFragment.getAppSettings().getKeyId() == Id.key.none) {
Toast.makeText(CryptoServiceActivity.this, Toast.makeText(CryptoServiceActivity.this,
R.string.api_register_error_select_key, Toast.LENGTH_LONG) R.string.api_register_error_select_key, Toast.LENGTH_LONG)
.show(); .show();
} else { } else {
ProviderHelper.insertApiApp(CryptoServiceActivity.this, ProviderHelper.insertApiApp(CryptoServiceActivity.this,
settingsFragment.getAppSettings()); mSettingsFragment.getAppSettings());
try { try {
mServiceCallback.onRegistered(true, packageName); mServiceCallback.onRegistered(true, packageName);
@@ -183,11 +182,11 @@ public class CryptoServiceActivity extends SherlockFragmentActivity {
setContentView(R.layout.api_app_register_activity); setContentView(R.layout.api_app_register_activity);
settingsFragment = (AppSettingsFragment) getSupportFragmentManager().findFragmentById( mSettingsFragment = (AppSettingsFragment) getSupportFragmentManager().findFragmentById(
R.id.api_app_settings_fragment); R.id.api_app_settings_fragment);
AppSettings settings = new AppSettings(packageName); AppSettings settings = new AppSettings(packageName);
settingsFragment.setAppSettings(settings); mSettingsFragment.setAppSettings(settings);
// TODO: handle if app is already registered // TODO: handle if app is already registered
// LinearLayout layoutRegister = (LinearLayout) // LinearLayout layoutRegister = (LinearLayout)
@@ -211,6 +210,7 @@ public class CryptoServiceActivity extends SherlockFragmentActivity {
showPassphraseDialog(secretKeyId); showPassphraseDialog(secretKeyId);
} else if (ACTION_SELECT_PUB_KEYS.equals(action)) { } else if (ACTION_SELECT_PUB_KEYS.equals(action)) {
long[] selectedMasterKeyIds = intent.getLongArrayExtra(EXTRA_SELECTED_MASTER_KEY_IDS);
// Inflate a "Done"/"Cancel" custom action bar view // Inflate a "Done"/"Cancel" custom action bar view
ActionBarHelper.setDoneCancelView(getSupportActionBar(), R.string.btn_okay, ActionBarHelper.setDoneCancelView(getSupportActionBar(), R.string.btn_okay,
@@ -219,15 +219,51 @@ public class CryptoServiceActivity extends SherlockFragmentActivity {
public void onClick(View v) { public void onClick(View v) {
// ok // ok
try {
mServiceCallback.onSelectedPublicKeys(mSelectFragment
.getSelectedMasterKeyIds());
} catch (RemoteException e) {
Log.e(Constants.TAG, "ServiceActivity");
}
finish();
} }
}, R.string.btn_doNotSave, new View.OnClickListener() { }, R.string.btn_doNotSave, new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
// cancel // cancel
// TODO: currently does the same as OK...
try {
mServiceCallback.onSelectedPublicKeys(mSelectFragment
.getSelectedMasterKeyIds());
} catch (RemoteException e) {
Log.e(Constants.TAG, "ServiceActivity");
}
finish();
} }
}); });
setContentView(R.layout.api_app_select_pub_keys_activity);
// Check that the activity is using the layout version with
// the fragment_container FrameLayout
if (findViewById(R.id.api_select_pub_keys_fragment_container) != null) {
// However, if we're being restored from a previous state,
// then we don't need to do anything and should return or else
// we could end up with overlapping fragments.
if (savedInstanceState != null) {
return;
}
// Create an instance of the fragment
mSelectFragment = SelectPublicKeyFragment.newInstance(selectedMasterKeyIds);
// Add the fragment to the 'fragment_container' FrameLayout
getSupportFragmentManager().beginTransaction()
.add(R.id.api_select_pub_keys_fragment_container, mSelectFragment).commit();
}
} else { } else {
Log.e(Constants.TAG, "Wrong action!"); Log.e(Constants.TAG, "Wrong action!");
finish(); finish();

View File

@@ -27,28 +27,26 @@ import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.spongycastle.openpgp.PGPPublicKeyRing; import org.spongycastle.openpgp.PGPPublicKeyRing;
import org.spongycastle.openpgp.PGPSecretKey; import org.spongycastle.openpgp.PGPSecretKey;
import org.spongycastle.openpgp.PGPSecretKeyRing; import org.spongycastle.openpgp.PGPSecretKeyRing;
import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.Id; import org.sufficientlysecure.keychain.Id;
import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.helper.FileHelper; import org.sufficientlysecure.keychain.helper.FileHelper;
import org.sufficientlysecure.keychain.helper.OtherHelper; import org.sufficientlysecure.keychain.helper.OtherHelper;
import org.sufficientlysecure.keychain.helper.PgpConversionHelper; import org.sufficientlysecure.keychain.helper.PgpConversionHelper;
import org.sufficientlysecure.keychain.helper.PgpMain; import org.sufficientlysecure.keychain.helper.PgpMain;
import org.sufficientlysecure.keychain.helper.Preferences;
import org.sufficientlysecure.keychain.helper.PgpMain.PgpGeneralException; import org.sufficientlysecure.keychain.helper.PgpMain.PgpGeneralException;
import org.sufficientlysecure.keychain.provider.ProviderHelper; import org.sufficientlysecure.keychain.helper.Preferences;
import org.sufficientlysecure.keychain.provider.KeychainContract.DataStream; import org.sufficientlysecure.keychain.provider.KeychainContract.DataStream;
import org.sufficientlysecure.keychain.provider.ProviderHelper;
import org.sufficientlysecure.keychain.util.HkpKeyServer; import org.sufficientlysecure.keychain.util.HkpKeyServer;
import org.sufficientlysecure.keychain.util.InputData; import org.sufficientlysecure.keychain.util.InputData;
import org.sufficientlysecure.keychain.util.KeyServer.KeyInfo;
import org.sufficientlysecure.keychain.util.Log; import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.ProgressDialogUpdater; import org.sufficientlysecure.keychain.util.ProgressDialogUpdater;
import org.sufficientlysecure.keychain.util.KeyServer.KeyInfo;
import org.sufficientlysecure.keychain.R;
import android.app.IntentService; import android.app.IntentService;
import android.content.Context; import android.content.Context;
@@ -316,11 +314,6 @@ public class KeychainIntentService extends IntentService implements ProgressDial
} }
/* Operation */ /* Operation */
// convert to arraylist
ArrayList<Long> keyIdsList = new ArrayList<Long>(encryptionKeyIds.length);
for (long n : encryptionKeyIds)
keyIdsList.add(n);
if (generateSignature) { if (generateSignature) {
Log.d(Constants.TAG, "generating signature..."); Log.d(Constants.TAG, "generating signature...");
PgpMain.generateSignature(this, this, inputData, outStream, useAsciiArmor, PgpMain.generateSignature(this, this, inputData, outStream, useAsciiArmor,
@@ -337,7 +330,7 @@ public class KeychainIntentService extends IntentService implements ProgressDial
} else { } else {
Log.d(Constants.TAG, "encrypt..."); Log.d(Constants.TAG, "encrypt...");
PgpMain.encryptAndSign(this, this, inputData, outStream, useAsciiArmor, PgpMain.encryptAndSign(this, this, inputData, outStream, useAsciiArmor,
compressionId, keyIdsList, encryptionPassphrase, Preferences compressionId, encryptionKeyIds, encryptionPassphrase, Preferences
.getPreferences(this).getDefaultEncryptionAlgorithm(), .getPreferences(this).getDefaultEncryptionAlgorithm(),
secretKeyId, secretKeyId,
Preferences.getPreferences(this).getDefaultHashAlgorithm(), Preferences Preferences.getPreferences(this).getDefaultHashAlgorithm(), Preferences