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