Safeslinger: more simplification

This commit is contained in:
Dominik Schürmann 2014-09-04 14:59:39 +02:00
parent 7b51718c92
commit 8cf4e25320

View File

@ -267,7 +267,8 @@ public class ViewKeyShareFragment extends LoaderFragment implements
} }
private static byte[] getSlingedKeys(Intent data) { private static byte[] getSlingedKeys(Intent data) {
ArrayList<byte[]> theirSecrets = new ArrayList<byte[]>(); ByteArrayOutputStream out = new ByteArrayOutputStream();
Bundle extras = data.getExtras(); Bundle extras = data.getExtras();
if (extras != null) { if (extras != null) {
byte[] d; byte[] d;
@ -275,21 +276,16 @@ public class ViewKeyShareFragment extends LoaderFragment implements
do { do {
d = extras.getByteArray(ExchangeConfig.extra.MEMBER_DATA + i); d = extras.getByteArray(ExchangeConfig.extra.MEMBER_DATA + i);
if (d != null) { if (d != null) {
theirSecrets.add(d); try {
out.write(d);
} catch (IOException e) {
Log.e(Constants.TAG, "IOException", e);
}
i++; i++;
} }
} while (d != null); } while (d != null);
} }
// concatenate keys
ByteArrayOutputStream out = new ByteArrayOutputStream();
for (byte[] t : theirSecrets) {
try {
out.write(t);
} catch (IOException e) {
Log.e(Constants.TAG, "IOException", e);
}
}
return out.toByteArray(); return out.toByteArray();
} }