fix sync information encryption

pull/5/head
Felix Prahl-Kamps 2019-07-15 17:46:37 +02:00
parent 8bdab947f1
commit dea7370b83
1 changed files with 2 additions and 2 deletions

View File

@ -68,7 +68,6 @@ public class ExchangeActivity extends AppCompatActivity {
uploadInformation = new UploadInformation();
publicKeyQr = generatePublicKeyBitmap();
dataQr = generateLocalSyncInfoBitmap();
setSyncState(SyncState.KEY_EXCHANGE);
}
@ -112,7 +111,7 @@ public class ExchangeActivity extends AppCompatActivity {
private Bitmap generateLocalSyncInfoBitmap() {
uploadInformation.setLocal(generateLocalSyncInfo());
return qrCodeGenerator.generateQrCode(new Gson().toJson(uploadInformation.getLocal()));
return qrCodeGenerator.generateQrCode(diffieHellman.encrypt(new Gson().toJson(uploadInformation.getLocal())));
}
private SyncInformation generateLocalSyncInfo() {
@ -273,6 +272,7 @@ public class ExchangeActivity extends AppCompatActivity {
try {
diffieHellman.setForeignPublicKey(DiffieHellman.publicKeyFromString(qrData));
setSyncState(SyncState.KEY_EXCHANGE_DONE);
dataQr = generateLocalSyncInfoBitmap();
} catch (InvalidKeySpecException | NoSuchAlgorithmException e) {
if (currentReadQrStatus == ReadQrStatus.PENDING) {
setReadQrStatus(ReadQrStatus.FAILURE);