Skip to content

Commit e8b242a

Browse files
committed
Added imports, formatted
1 parent ec960d8 commit e8b242a

File tree

12 files changed

+51
-39
lines changed

12 files changed

+51
-39
lines changed

TLS-Core/src/main/java/de/rub/nds/tlsattacker/core/constants/KeyUpdateRequest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
* Licensed under Apache License 2.0
88
* http://www.apache.org/licenses/LICENSE-2.0
99
*/
10+
1011
package de.rub.nds.tlsattacker.core.constants;
1112

1213
import de.rub.nds.modifiablevariable.ModifiableVariableFactory;

TLS-Core/src/main/java/de/rub/nds/tlsattacker/core/crypto/HKDFunction.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ public class HKDFunction {
6363

6464
public static final String TRAFFICUPD = "traffic upd";
6565

66-
6766
private HKDFunction() {
6867
}
6968

TLS-Core/src/main/java/de/rub/nds/tlsattacker/core/protocol/handler/KeyUpdateHandler.java

Lines changed: 39 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
* Licensed under Apache License 2.0
88
* http://www.apache.org/licenses/LICENSE-2.0
99
*/
10+
1011
package de.rub.nds.tlsattacker.core.protocol.handler;
1112

1213
import de.rub.nds.modifiablevariable.util.ArrayConverter;
@@ -61,7 +62,7 @@ public void adjustTlsContextAfterSerialize(KeyUpdateMessage message) {
6162
@Override
6263
public ProtocolMessageParser getParser(byte[] message, int pointer) {
6364
return new KeyUpdateParser(pointer, message, tlsContext.getChooser().getSelectedProtocolVersion(),
64-
tlsContext.getConfig());
65+
tlsContext.getConfig());
6566

6667
}
6768

@@ -76,31 +77,31 @@ public ProtocolMessageSerializer getSerializer(KeyUpdateMessage message) {
7677
}
7778

7879
private void adjustApplicationTrafficSecrets() {
79-
HKDFAlgorithm hkdfAlgortihm = AlgorithmResolver.getHKDFAlgorithm(tlsContext.getChooser()
80-
.getSelectedCipherSuite());
80+
HKDFAlgorithm hkdfAlgortihm =
81+
AlgorithmResolver.getHKDFAlgorithm(tlsContext.getChooser().getSelectedCipherSuite());
8182

8283
try {
8384
Mac mac = Mac.getInstance(hkdfAlgortihm.getMacAlgorithm().getJavaName());
8485

8586
if (tlsContext.getChooser().getTalkingConnectionEnd() == ConnectionEndType.CLIENT) {
8687

87-
byte[] clientApplicationTrafficSecret = HKDFunction.expandLabel(hkdfAlgortihm,
88-
tlsContext.getClientApplicationTrafficSecret(), HKDFunction.TRAFFICUPD, new byte[0],
89-
mac.getMacLength());
88+
byte[] clientApplicationTrafficSecret =
89+
HKDFunction.expandLabel(hkdfAlgortihm, tlsContext.getClientApplicationTrafficSecret(),
90+
HKDFunction.TRAFFICUPD, new byte[0], mac.getMacLength());
9091

9192
tlsContext.setClientApplicationTrafficSecret(clientApplicationTrafficSecret);
9293
LOGGER.debug("Set clientApplicationTrafficSecret in Context to "
93-
+ ArrayConverter.bytesToHexString(clientApplicationTrafficSecret));
94+
+ ArrayConverter.bytesToHexString(clientApplicationTrafficSecret));
9495

9596
} else {
9697

97-
byte[] serverApplicationTrafficSecret = HKDFunction.expandLabel(hkdfAlgortihm,
98-
tlsContext.getServerApplicationTrafficSecret(), HKDFunction.TRAFFICUPD, new byte[0],
99-
mac.getMacLength());
98+
byte[] serverApplicationTrafficSecret =
99+
HKDFunction.expandLabel(hkdfAlgortihm, tlsContext.getServerApplicationTrafficSecret(),
100+
HKDFunction.TRAFFICUPD, new byte[0], mac.getMacLength());
100101

101102
tlsContext.setServerApplicationTrafficSecret(serverApplicationTrafficSecret);
102103
LOGGER.debug("Set serverApplicationTrafficSecret in Context to "
103-
+ ArrayConverter.bytesToHexString(serverApplicationTrafficSecret));
104+
+ ArrayConverter.bytesToHexString(serverApplicationTrafficSecret));
104105

105106
}
106107

@@ -112,8 +113,8 @@ private void adjustApplicationTrafficSecrets() {
112113
private KeySet getKeySet(TlsContext context, Tls13KeySetType keySetType) {
113114
try {
114115
LOGGER.debug("Generating new KeySet");
115-
KeySet keySet = KeySetGenerator.generateKeySet(context, context.getChooser().getSelectedProtocolVersion(),
116-
keySetType);
116+
KeySet keySet =
117+
KeySetGenerator.generateKeySet(context, context.getChooser().getSelectedProtocolVersion(), keySetType);
117118

118119
return keySet;
119120
} catch (NoSuchAlgorithmException | CryptoException ex) {
@@ -125,8 +126,8 @@ private void setRecordCipher(Tls13KeySetType keySetType) {
125126
try {
126127
int AEAD_IV_LENGTH = 12;
127128
KeySet keySet;
128-
HKDFAlgorithm hkdfAlgortihm = AlgorithmResolver.getHKDFAlgorithm(tlsContext.getChooser()
129-
.getSelectedCipherSuite());
129+
HKDFAlgorithm hkdfAlgortihm =
130+
AlgorithmResolver.getHKDFAlgorithm(tlsContext.getChooser().getSelectedCipherSuite());
130131

131132
if (tlsContext.getChooser().getTalkingConnectionEnd() == ConnectionEndType.CLIENT) {
132133

@@ -145,52 +146,54 @@ private void setRecordCipher(Tls13KeySetType keySetType) {
145146
if (tlsContext.getChooser().getConnectionEndType() == ConnectionEndType.CLIENT) {
146147

147148
keySet.setClientWriteIv(HKDFunction.expandLabel(hkdfAlgortihm,
148-
tlsContext.getClientApplicationTrafficSecret(), HKDFunction.IV, new byte[0], AEAD_IV_LENGTH));
149+
tlsContext.getClientApplicationTrafficSecret(), HKDFunction.IV, new byte[0], AEAD_IV_LENGTH));
149150

150-
keySet.setClientWriteKey(HKDFunction.expandLabel(hkdfAlgortihm,
151-
tlsContext.getClientApplicationTrafficSecret(), HKDFunction.KEY, new byte[0],
152-
AlgorithmResolver.getCipher(tlsContext.getChooser().getSelectedCipherSuite()).getKeySize()));
151+
keySet.setClientWriteKey(HKDFunction.expandLabel(hkdfAlgortihm, tlsContext
152+
.getClientApplicationTrafficSecret(), HKDFunction.KEY, new byte[0], AlgorithmResolver
153+
.getCipher(tlsContext.getChooser().getSelectedCipherSuite()).getKeySize()));
153154
} else {
154155

155156
keySet.setServerWriteIv(HKDFunction.expandLabel(hkdfAlgortihm,
156-
tlsContext.getServerApplicationTrafficSecret(), HKDFunction.IV, new byte[0], AEAD_IV_LENGTH));
157+
tlsContext.getServerApplicationTrafficSecret(), HKDFunction.IV, new byte[0], AEAD_IV_LENGTH));
157158

158-
keySet.setServerWriteKey(HKDFunction.expandLabel(hkdfAlgortihm,
159-
tlsContext.getServerApplicationTrafficSecret(), HKDFunction.KEY, new byte[0],
160-
AlgorithmResolver.getCipher(tlsContext.getChooser().getSelectedCipherSuite()).getKeySize()));
159+
keySet.setServerWriteKey(HKDFunction.expandLabel(hkdfAlgortihm, tlsContext
160+
.getServerApplicationTrafficSecret(), HKDFunction.KEY, new byte[0], AlgorithmResolver
161+
.getCipher(tlsContext.getChooser().getSelectedCipherSuite()).getKeySize()));
161162
}
162163

163-
RecordCipher recordCipherClient = RecordCipherFactory.getRecordCipher(tlsContext, keySet, tlsContext
164-
.getChooser().getSelectedCipherSuite());
164+
RecordCipher recordCipherClient =
165+
RecordCipherFactory.getRecordCipher(tlsContext, keySet, tlsContext.getChooser()
166+
.getSelectedCipherSuite());
165167
tlsContext.getRecordLayer().setRecordCipher(recordCipherClient);
166168

167169
tlsContext.setWriteSequenceNumber(0);
168170
tlsContext.getRecordLayer().updateEncryptionCipher();
169171

170172
} else if (tlsContext.getChooser().getTalkingConnectionEnd() != tlsContext.getChooser()
171-
.getConnectionEndType()) {
173+
.getConnectionEndType()) {
172174

173175
if (tlsContext.getChooser().getTalkingConnectionEnd() == ConnectionEndType.SERVER) {
174176

175177
keySet.setServerWriteIv(HKDFunction.expandLabel(hkdfAlgortihm,
176-
tlsContext.getServerApplicationTrafficSecret(), HKDFunction.IV, new byte[0], AEAD_IV_LENGTH));
178+
tlsContext.getServerApplicationTrafficSecret(), HKDFunction.IV, new byte[0], AEAD_IV_LENGTH));
177179

178-
keySet.setServerWriteKey(HKDFunction.expandLabel(hkdfAlgortihm,
179-
tlsContext.getServerApplicationTrafficSecret(), HKDFunction.KEY, new byte[0],
180-
AlgorithmResolver.getCipher(tlsContext.getChooser().getSelectedCipherSuite()).getKeySize()));
180+
keySet.setServerWriteKey(HKDFunction.expandLabel(hkdfAlgortihm, tlsContext
181+
.getServerApplicationTrafficSecret(), HKDFunction.KEY, new byte[0], AlgorithmResolver
182+
.getCipher(tlsContext.getChooser().getSelectedCipherSuite()).getKeySize()));
181183

182184
} else {
183185

184186
keySet.setClientWriteIv(HKDFunction.expandLabel(hkdfAlgortihm,
185-
tlsContext.getClientApplicationTrafficSecret(), HKDFunction.IV, new byte[0], AEAD_IV_LENGTH));
187+
tlsContext.getClientApplicationTrafficSecret(), HKDFunction.IV, new byte[0], AEAD_IV_LENGTH));
186188

187-
keySet.setClientWriteKey(HKDFunction.expandLabel(hkdfAlgortihm,
188-
tlsContext.getClientApplicationTrafficSecret(), HKDFunction.KEY, new byte[0],
189-
AlgorithmResolver.getCipher(tlsContext.getChooser().getSelectedCipherSuite()).getKeySize()));
189+
keySet.setClientWriteKey(HKDFunction.expandLabel(hkdfAlgortihm, tlsContext
190+
.getClientApplicationTrafficSecret(), HKDFunction.KEY, new byte[0], AlgorithmResolver
191+
.getCipher(tlsContext.getChooser().getSelectedCipherSuite()).getKeySize()));
190192
}
191193

192-
RecordCipher recordCipherClient = RecordCipherFactory.getRecordCipher(tlsContext, keySet, tlsContext
193-
.getChooser().getSelectedCipherSuite());
194+
RecordCipher recordCipherClient =
195+
RecordCipherFactory.getRecordCipher(tlsContext, keySet, tlsContext.getChooser()
196+
.getSelectedCipherSuite());
194197
tlsContext.getRecordLayer().setRecordCipher(recordCipherClient);
195198

196199
tlsContext.setReadSequenceNumber(0);

TLS-Core/src/main/java/de/rub/nds/tlsattacker/core/protocol/handler/factory/HandlerFactory.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
import de.rub.nds.tlsattacker.core.protocol.handler.HelloRequestHandler;
3939
import de.rub.nds.tlsattacker.core.protocol.handler.HelloRetryRequestHandler;
4040
import de.rub.nds.tlsattacker.core.protocol.handler.HelloVerifyRequestHandler;
41+
import de.rub.nds.tlsattacker.core.protocol.handler.KeyUpdateHandler;
4142
import de.rub.nds.tlsattacker.core.protocol.handler.NewSessionTicketHandler;
4243
import de.rub.nds.tlsattacker.core.protocol.handler.PWDClientKeyExchangeHandler;
4344
import de.rub.nds.tlsattacker.core.protocol.handler.PWDServerKeyExchangeHandler;

TLS-Core/src/main/java/de/rub/nds/tlsattacker/core/protocol/message/KeyUpdateMessage.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
* Licensed under Apache License 2.0
88
* http://www.apache.org/licenses/LICENSE-2.0
99
*/
10+
1011
package de.rub.nds.tlsattacker.core.protocol.message;
1112

1213
import de.rub.nds.tlsattacker.core.config.Config;

TLS-Core/src/main/java/de/rub/nds/tlsattacker/core/protocol/parser/KeyUpdateParser.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
* Licensed under Apache License 2.0
88
* http://www.apache.org/licenses/LICENSE-2.0
99
*/
10+
1011
package de.rub.nds.tlsattacker.core.protocol.parser;
1112

1213
import org.apache.logging.log4j.LogManager;

TLS-Core/src/main/java/de/rub/nds/tlsattacker/core/protocol/preparator/KeyUpdatePreparator.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
* Licensed under Apache License 2.0
88
* http://www.apache.org/licenses/LICENSE-2.0
99
*/
10+
1011
package de.rub.nds.tlsattacker.core.protocol.preparator;
1112

1213
import de.rub.nds.tlsattacker.core.constants.KeyUpdateRequest;

TLS-Core/src/main/java/de/rub/nds/tlsattacker/core/protocol/serializer/KeyUpdateSerializer.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
* Licensed under Apache License 2.0
88
* http://www.apache.org/licenses/LICENSE-2.0
99
*/
10+
1011
package de.rub.nds.tlsattacker.core.protocol.serializer;
1112

1213
import de.rub.nds.tlsattacker.core.constants.ProtocolVersion;
@@ -25,9 +26,9 @@ public class KeyUpdateSerializer extends HandshakeMessageSerializer<KeyUpdateMes
2526
* Constructor for the FinishedMessageSerializer
2627
*
2728
* @param message
28-
* Message that should be serialized
29+
* Message that should be serialized
2930
* @param version
30-
* Version of the Protocol
31+
* Version of the Protocol
3132
*/
3233

3334
public KeyUpdateSerializer(KeyUpdateMessage message, ProtocolVersion version) {

TLS-Core/src/main/java/de/rub/nds/tlsattacker/core/workflow/action/ForwardMessagesAction.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
import de.rub.nds.tlsattacker.core.protocol.message.HelloRequestMessage;
4040
import de.rub.nds.tlsattacker.core.protocol.message.HelloRetryRequestMessage;
4141
import de.rub.nds.tlsattacker.core.protocol.message.HelloVerifyRequestMessage;
42+
import de.rub.nds.tlsattacker.core.protocol.message.KeyUpdateMessage;
4243
import de.rub.nds.tlsattacker.core.protocol.message.NewSessionTicketMessage;
4344
import de.rub.nds.tlsattacker.core.protocol.message.PWDClientKeyExchangeMessage;
4445
import de.rub.nds.tlsattacker.core.protocol.message.PWDServerKeyExchangeMessage;

TLS-Core/src/main/java/de/rub/nds/tlsattacker/core/workflow/action/MessageAction.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import de.rub.nds.tlsattacker.core.protocol.message.HelloRequestMessage;
3636
import de.rub.nds.tlsattacker.core.protocol.message.HelloRetryRequestMessage;
3737
import de.rub.nds.tlsattacker.core.protocol.message.HelloVerifyRequestMessage;
38+
import de.rub.nds.tlsattacker.core.protocol.message.KeyUpdateMessage;
3839
import de.rub.nds.tlsattacker.core.protocol.message.NewSessionTicketMessage;
3940
import de.rub.nds.tlsattacker.core.protocol.message.PWDClientKeyExchangeMessage;
4041
import de.rub.nds.tlsattacker.core.protocol.message.PWDServerKeyExchangeMessage;

0 commit comments

Comments
 (0)