Fixed incomplete agreement

This commit is contained in:
Marcin Kostrzewski 2020-11-16 12:22:26 +01:00
parent f2cea164ae
commit 71c2a48a1f

View File

@ -65,6 +65,9 @@ public class DHExchange {
agreement.init(keyPair.getPrivate()); agreement.init(keyPair.getPrivate());
thisPublicKey = keyPair.getPublic(); thisPublicKey = keyPair.getPublic();
agreement.doPhase(otherPublicKey, true);
generateSecret();
} catch (NoSuchAlgorithmException | InvalidKeySpecException | InvalidAlgorithmParameterException | InvalidKeyException e) { } catch (NoSuchAlgorithmException | InvalidKeySpecException | InvalidAlgorithmParameterException | InvalidKeyException e) {
e.printStackTrace(); e.printStackTrace();
@ -80,6 +83,7 @@ public class DHExchange {
logger.log(Level.INFO, "Agreement phase..."); logger.log(Level.INFO, "Agreement phase...");
agreement.doPhase(otherPublicKey, true); agreement.doPhase(otherPublicKey, true);
generateSecret();
} catch (NoSuchAlgorithmException | InvalidKeySpecException | InvalidKeyException e) { } catch (NoSuchAlgorithmException | InvalidKeySpecException | InvalidKeyException e) {
e.printStackTrace(); e.printStackTrace();
} }