Save challenge for later

This commit is contained in:
Tobias Eidelpes 2020-12-26 16:36:12 +01:00
parent 64a12a816f
commit 6666494009

View File

@ -41,6 +41,7 @@ public class MessageClient implements IMessageClient, Runnable {
private BufferedReader dmapIn;
private Cipher aesCipher;
private byte[] challenge;
/**
* Creates a new client instance.
@ -160,9 +161,9 @@ public class MessageClient implements IMessageClient, Runnable {
private byte[] generateChallenge(PublicKey serverPublicKey) {
SecureRandom secureRandom = new SecureRandom();
// Generate new random 32 byte challenge
byte[] clearTextChallenge = new byte[32];
secureRandom.nextBytes(clearTextChallenge);
return clearTextChallenge;
this.challenge = new byte[32];
secureRandom.nextBytes(this.challenge);
return this.challenge;
}
private String generateChallengeMessage(PublicKey serverPublicKey) {