mirror of https://github.com/MISP/misp-bump
fix sync information encryption
parent
8bdab947f1
commit
dea7370b83
|
@ -68,7 +68,6 @@ public class ExchangeActivity extends AppCompatActivity {
|
||||||
|
|
||||||
uploadInformation = new UploadInformation();
|
uploadInformation = new UploadInformation();
|
||||||
publicKeyQr = generatePublicKeyBitmap();
|
publicKeyQr = generatePublicKeyBitmap();
|
||||||
dataQr = generateLocalSyncInfoBitmap();
|
|
||||||
|
|
||||||
setSyncState(SyncState.KEY_EXCHANGE);
|
setSyncState(SyncState.KEY_EXCHANGE);
|
||||||
}
|
}
|
||||||
|
@ -112,7 +111,7 @@ public class ExchangeActivity extends AppCompatActivity {
|
||||||
|
|
||||||
private Bitmap generateLocalSyncInfoBitmap() {
|
private Bitmap generateLocalSyncInfoBitmap() {
|
||||||
uploadInformation.setLocal(generateLocalSyncInfo());
|
uploadInformation.setLocal(generateLocalSyncInfo());
|
||||||
return qrCodeGenerator.generateQrCode(new Gson().toJson(uploadInformation.getLocal()));
|
return qrCodeGenerator.generateQrCode(diffieHellman.encrypt(new Gson().toJson(uploadInformation.getLocal())));
|
||||||
}
|
}
|
||||||
|
|
||||||
private SyncInformation generateLocalSyncInfo() {
|
private SyncInformation generateLocalSyncInfo() {
|
||||||
|
@ -273,6 +272,7 @@ public class ExchangeActivity extends AppCompatActivity {
|
||||||
try {
|
try {
|
||||||
diffieHellman.setForeignPublicKey(DiffieHellman.publicKeyFromString(qrData));
|
diffieHellman.setForeignPublicKey(DiffieHellman.publicKeyFromString(qrData));
|
||||||
setSyncState(SyncState.KEY_EXCHANGE_DONE);
|
setSyncState(SyncState.KEY_EXCHANGE_DONE);
|
||||||
|
dataQr = generateLocalSyncInfoBitmap();
|
||||||
} catch (InvalidKeySpecException | NoSuchAlgorithmException e) {
|
} catch (InvalidKeySpecException | NoSuchAlgorithmException e) {
|
||||||
if (currentReadQrStatus == ReadQrStatus.PENDING) {
|
if (currentReadQrStatus == ReadQrStatus.PENDING) {
|
||||||
setReadQrStatus(ReadQrStatus.FAILURE);
|
setReadQrStatus(ReadQrStatus.FAILURE);
|
||||||
|
|
Loading…
Reference in New Issue