Safeslinger: get all bytes

This commit is contained in:
Dominik Schürmann 2014-09-04 14:34:59 +02:00
parent 4872fd5b2d
commit b1c3bfa157

View File

@ -54,8 +54,11 @@ import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.Notify; import org.sufficientlysecure.keychain.util.Notify;
import org.sufficientlysecure.keychain.util.QrCodeUtils; import org.sufficientlysecure.keychain.util.QrCodeUtils;
import java.io.ByteArrayOutputStream;
import java.io.IOException; import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import edu.cmu.cylab.starslinger.exchange.ExchangeActivity; import edu.cmu.cylab.starslinger.exchange.ExchangeActivity;
import edu.cmu.cylab.starslinger.exchange.ExchangeConfig; import edu.cmu.cylab.starslinger.exchange.ExchangeConfig;
@ -253,8 +256,15 @@ public class ViewKeyShareFragment extends LoaderFragment implements
ArrayList<byte[]> theirSecrets = endExchange(data); ArrayList<byte[]> theirSecrets = endExchange(data);
Intent importIntent = new Intent(getActivity(), ImportKeysActivity.class); Intent importIntent = new Intent(getActivity(), ImportKeysActivity.class);
importIntent.setAction(ImportKeysActivity.ACTION_IMPORT_KEY); importIntent.setAction(ImportKeysActivity.ACTION_IMPORT_KEY);
// TODO ByteArrayOutputStream out = new ByteArrayOutputStream();
importIntent.putExtra(ImportKeysActivity.EXTRA_KEY_BYTES, theirSecrets.get(0)); for (byte[] t : theirSecrets) {
try {
out.write(t);
} catch (IOException e) {
Log.e(Constants.TAG, "IOException", e);
}
}
importIntent.putExtra(ImportKeysActivity.EXTRA_KEY_BYTES, out.toByteArray());
startActivity(importIntent); startActivity(importIntent);
break; break;
case ExchangeActivity.RESULT_EXCHANGE_CANCELED: case ExchangeActivity.RESULT_EXCHANGE_CANCELED: