|
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 | 9 |
|
11 | 10 | package de.rub.nds.tlsattacker.core.protocol.handler; |
@@ -148,52 +147,50 @@ private void setRecordCipher(Tls13KeySetType keySetType) { |
148 | 147 | keySet.setClientWriteIv(HKDFunction.expandLabel(hkdfAlgortihm, |
149 | 148 | tlsContext.getClientApplicationTrafficSecret(), HKDFunction.IV, new byte[0], AEAD_IV_LENGTH)); |
150 | 149 |
|
151 | | - keySet.setClientWriteKey(HKDFunction.expandLabel(hkdfAlgortihm, tlsContext |
152 | | - .getClientApplicationTrafficSecret(), HKDFunction.KEY, new byte[0], AlgorithmResolver |
153 | | - .getCipher(tlsContext.getChooser().getSelectedCipherSuite()).getKeySize())); |
| 150 | + keySet.setClientWriteKey(HKDFunction.expandLabel(hkdfAlgortihm, |
| 151 | + tlsContext.getClientApplicationTrafficSecret(), HKDFunction.KEY, new byte[0], |
| 152 | + AlgorithmResolver.getCipher(tlsContext.getChooser().getSelectedCipherSuite()).getKeySize())); |
154 | 153 | } else { |
155 | 154 |
|
156 | 155 | keySet.setServerWriteIv(HKDFunction.expandLabel(hkdfAlgortihm, |
157 | 156 | tlsContext.getServerApplicationTrafficSecret(), HKDFunction.IV, new byte[0], AEAD_IV_LENGTH)); |
158 | 157 |
|
159 | | - keySet.setServerWriteKey(HKDFunction.expandLabel(hkdfAlgortihm, tlsContext |
160 | | - .getServerApplicationTrafficSecret(), HKDFunction.KEY, new byte[0], AlgorithmResolver |
161 | | - .getCipher(tlsContext.getChooser().getSelectedCipherSuite()).getKeySize())); |
| 158 | + keySet.setServerWriteKey(HKDFunction.expandLabel(hkdfAlgortihm, |
| 159 | + tlsContext.getServerApplicationTrafficSecret(), HKDFunction.KEY, new byte[0], |
| 160 | + AlgorithmResolver.getCipher(tlsContext.getChooser().getSelectedCipherSuite()).getKeySize())); |
162 | 161 | } |
163 | 162 |
|
164 | | - RecordCipher recordCipherClient = |
165 | | - RecordCipherFactory.getRecordCipher(tlsContext, keySet, tlsContext.getChooser() |
166 | | - .getSelectedCipherSuite()); |
| 163 | + RecordCipher recordCipherClient = RecordCipherFactory.getRecordCipher(tlsContext, keySet, |
| 164 | + tlsContext.getChooser().getSelectedCipherSuite()); |
167 | 165 | tlsContext.getRecordLayer().setRecordCipher(recordCipherClient); |
168 | 166 |
|
169 | 167 | tlsContext.setWriteSequenceNumber(0); |
170 | 168 | tlsContext.getRecordLayer().updateEncryptionCipher(); |
171 | 169 |
|
172 | | - } else if (tlsContext.getChooser().getTalkingConnectionEnd() != tlsContext.getChooser() |
173 | | - .getConnectionEndType()) { |
| 170 | + } else if (tlsContext.getChooser().getTalkingConnectionEnd() |
| 171 | + != tlsContext.getChooser().getConnectionEndType()) { |
174 | 172 |
|
175 | 173 | if (tlsContext.getChooser().getTalkingConnectionEnd() == ConnectionEndType.SERVER) { |
176 | 174 |
|
177 | 175 | keySet.setServerWriteIv(HKDFunction.expandLabel(hkdfAlgortihm, |
178 | 176 | tlsContext.getServerApplicationTrafficSecret(), HKDFunction.IV, new byte[0], AEAD_IV_LENGTH)); |
179 | 177 |
|
180 | | - keySet.setServerWriteKey(HKDFunction.expandLabel(hkdfAlgortihm, tlsContext |
181 | | - .getServerApplicationTrafficSecret(), HKDFunction.KEY, new byte[0], AlgorithmResolver |
182 | | - .getCipher(tlsContext.getChooser().getSelectedCipherSuite()).getKeySize())); |
| 178 | + keySet.setServerWriteKey(HKDFunction.expandLabel(hkdfAlgortihm, |
| 179 | + tlsContext.getServerApplicationTrafficSecret(), HKDFunction.KEY, new byte[0], |
| 180 | + AlgorithmResolver.getCipher(tlsContext.getChooser().getSelectedCipherSuite()).getKeySize())); |
183 | 181 |
|
184 | 182 | } else { |
185 | 183 |
|
186 | 184 | keySet.setClientWriteIv(HKDFunction.expandLabel(hkdfAlgortihm, |
187 | 185 | tlsContext.getClientApplicationTrafficSecret(), HKDFunction.IV, new byte[0], AEAD_IV_LENGTH)); |
188 | 186 |
|
189 | | - keySet.setClientWriteKey(HKDFunction.expandLabel(hkdfAlgortihm, tlsContext |
190 | | - .getClientApplicationTrafficSecret(), HKDFunction.KEY, new byte[0], AlgorithmResolver |
191 | | - .getCipher(tlsContext.getChooser().getSelectedCipherSuite()).getKeySize())); |
| 187 | + keySet.setClientWriteKey(HKDFunction.expandLabel(hkdfAlgortihm, |
| 188 | + tlsContext.getClientApplicationTrafficSecret(), HKDFunction.KEY, new byte[0], |
| 189 | + AlgorithmResolver.getCipher(tlsContext.getChooser().getSelectedCipherSuite()).getKeySize())); |
192 | 190 | } |
193 | 191 |
|
194 | | - RecordCipher recordCipherClient = |
195 | | - RecordCipherFactory.getRecordCipher(tlsContext, keySet, tlsContext.getChooser() |
196 | | - .getSelectedCipherSuite()); |
| 192 | + RecordCipher recordCipherClient = RecordCipherFactory.getRecordCipher(tlsContext, keySet, |
| 193 | + tlsContext.getChooser().getSelectedCipherSuite()); |
197 | 194 | tlsContext.getRecordLayer().setRecordCipher(recordCipherClient); |
198 | 195 |
|
199 | 196 | tlsContext.setReadSequenceNumber(0); |
|
0 commit comments