|
1 | 1 | /** |
2 | 2 | * TLS-Attacker - A Modular Penetration Testing Framework for TLS |
3 | 3 | * |
4 | | - * Copyright 2014-2020 Ruhr University Bochum, Paderborn University, |
5 | | - * and Hackmanit GmbH |
| 4 | + * Copyright 2014-2021 Ruhr University Bochum, Paderborn University, Hackmanit GmbH |
6 | 5 | * |
7 | | - * Licensed under Apache License 2.0 |
8 | | - * http://www.apache.org/licenses/LICENSE-2.0 |
| 6 | + * Licensed under Apache License, Version 2.0 |
| 7 | + * http://www.apache.org/licenses/LICENSE-2.0.txt |
9 | 8 | */ |
10 | | - |
11 | 9 | package de.rub.nds.tlsattacker.core.protocol.handler; |
12 | 10 |
|
13 | 11 | import de.rub.nds.modifiablevariable.util.ArrayConverter; |
@@ -148,52 +146,50 @@ private void setRecordCipher(Tls13KeySetType keySetType) { |
148 | 146 | keySet.setClientWriteIv(HKDFunction.expandLabel(hkdfAlgortihm, |
149 | 147 | tlsContext.getClientApplicationTrafficSecret(), HKDFunction.IV, new byte[0], AEAD_IV_LENGTH)); |
150 | 148 |
|
151 | | - keySet.setClientWriteKey(HKDFunction.expandLabel(hkdfAlgortihm, tlsContext |
152 | | - .getClientApplicationTrafficSecret(), HKDFunction.KEY, new byte[0], AlgorithmResolver |
153 | | - .getCipher(tlsContext.getChooser().getSelectedCipherSuite()).getKeySize())); |
| 149 | + keySet.setClientWriteKey(HKDFunction.expandLabel(hkdfAlgortihm, |
| 150 | + tlsContext.getClientApplicationTrafficSecret(), HKDFunction.KEY, new byte[0], |
| 151 | + AlgorithmResolver.getCipher(tlsContext.getChooser().getSelectedCipherSuite()).getKeySize())); |
154 | 152 | } else { |
155 | 153 |
|
156 | 154 | keySet.setServerWriteIv(HKDFunction.expandLabel(hkdfAlgortihm, |
157 | 155 | tlsContext.getServerApplicationTrafficSecret(), HKDFunction.IV, new byte[0], AEAD_IV_LENGTH)); |
158 | 156 |
|
159 | | - keySet.setServerWriteKey(HKDFunction.expandLabel(hkdfAlgortihm, tlsContext |
160 | | - .getServerApplicationTrafficSecret(), HKDFunction.KEY, new byte[0], AlgorithmResolver |
161 | | - .getCipher(tlsContext.getChooser().getSelectedCipherSuite()).getKeySize())); |
| 157 | + keySet.setServerWriteKey(HKDFunction.expandLabel(hkdfAlgortihm, |
| 158 | + tlsContext.getServerApplicationTrafficSecret(), HKDFunction.KEY, new byte[0], |
| 159 | + AlgorithmResolver.getCipher(tlsContext.getChooser().getSelectedCipherSuite()).getKeySize())); |
162 | 160 | } |
163 | 161 |
|
164 | | - RecordCipher recordCipherClient = |
165 | | - RecordCipherFactory.getRecordCipher(tlsContext, keySet, tlsContext.getChooser() |
166 | | - .getSelectedCipherSuite()); |
| 162 | + RecordCipher recordCipherClient = RecordCipherFactory.getRecordCipher(tlsContext, keySet, |
| 163 | + tlsContext.getChooser().getSelectedCipherSuite()); |
167 | 164 | tlsContext.getRecordLayer().setRecordCipher(recordCipherClient); |
168 | 165 |
|
169 | 166 | tlsContext.setWriteSequenceNumber(0); |
170 | 167 | tlsContext.getRecordLayer().updateEncryptionCipher(); |
171 | 168 |
|
172 | | - } else if (tlsContext.getChooser().getTalkingConnectionEnd() != tlsContext.getChooser() |
173 | | - .getConnectionEndType()) { |
| 169 | + } else if (tlsContext.getChooser().getTalkingConnectionEnd() |
| 170 | + != tlsContext.getChooser().getConnectionEndType()) { |
174 | 171 |
|
175 | 172 | if (tlsContext.getChooser().getTalkingConnectionEnd() == ConnectionEndType.SERVER) { |
176 | 173 |
|
177 | 174 | keySet.setServerWriteIv(HKDFunction.expandLabel(hkdfAlgortihm, |
178 | 175 | tlsContext.getServerApplicationTrafficSecret(), HKDFunction.IV, new byte[0], AEAD_IV_LENGTH)); |
179 | 176 |
|
180 | | - keySet.setServerWriteKey(HKDFunction.expandLabel(hkdfAlgortihm, tlsContext |
181 | | - .getServerApplicationTrafficSecret(), HKDFunction.KEY, new byte[0], AlgorithmResolver |
182 | | - .getCipher(tlsContext.getChooser().getSelectedCipherSuite()).getKeySize())); |
| 177 | + keySet.setServerWriteKey(HKDFunction.expandLabel(hkdfAlgortihm, |
| 178 | + tlsContext.getServerApplicationTrafficSecret(), HKDFunction.KEY, new byte[0], |
| 179 | + AlgorithmResolver.getCipher(tlsContext.getChooser().getSelectedCipherSuite()).getKeySize())); |
183 | 180 |
|
184 | 181 | } else { |
185 | 182 |
|
186 | 183 | keySet.setClientWriteIv(HKDFunction.expandLabel(hkdfAlgortihm, |
187 | 184 | tlsContext.getClientApplicationTrafficSecret(), HKDFunction.IV, new byte[0], AEAD_IV_LENGTH)); |
188 | 185 |
|
189 | | - keySet.setClientWriteKey(HKDFunction.expandLabel(hkdfAlgortihm, tlsContext |
190 | | - .getClientApplicationTrafficSecret(), HKDFunction.KEY, new byte[0], AlgorithmResolver |
191 | | - .getCipher(tlsContext.getChooser().getSelectedCipherSuite()).getKeySize())); |
| 186 | + keySet.setClientWriteKey(HKDFunction.expandLabel(hkdfAlgortihm, |
| 187 | + tlsContext.getClientApplicationTrafficSecret(), HKDFunction.KEY, new byte[0], |
| 188 | + AlgorithmResolver.getCipher(tlsContext.getChooser().getSelectedCipherSuite()).getKeySize())); |
192 | 189 | } |
193 | 190 |
|
194 | | - RecordCipher recordCipherClient = |
195 | | - RecordCipherFactory.getRecordCipher(tlsContext, keySet, tlsContext.getChooser() |
196 | | - .getSelectedCipherSuite()); |
| 191 | + RecordCipher recordCipherClient = RecordCipherFactory.getRecordCipher(tlsContext, keySet, |
| 192 | + tlsContext.getChooser().getSelectedCipherSuite()); |
197 | 193 | tlsContext.getRecordLayer().setRecordCipher(recordCipherClient); |
198 | 194 |
|
199 | 195 | tlsContext.setReadSequenceNumber(0); |
|
0 commit comments