Добавлена обработка ошибок при расшифровке TLS
This commit is contained in:
@@ -9,6 +9,8 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
public class TlsDecryptorTest {
|
||||
|
||||
@Test
|
||||
@@ -21,6 +23,14 @@ public class TlsDecryptorTest {
|
||||
|
||||
TlsDecryptor decryptor = new TlsDecryptor(packets, keysHolder);
|
||||
decryptor.decryptTls();
|
||||
|
||||
assertTrue(decryptor.isParsed(), "TLS not parsed");
|
||||
List<Packet> parsed = decryptor.getParsedPackets();
|
||||
assertNotNull(parsed, "Parsed packets list is null");
|
||||
assertEquals(4, parsed.size(), "Wrong packets list size");
|
||||
|
||||
assertTrue(new String(parsed.get(0).getContent()).contains("GET /"), "Wrong content at the start");
|
||||
assertTrue(new String(parsed.get(3).getContent()).contains("Not Found"), "Wrong content at the end");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
package ru.serega6531.packmate;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.pcap4j.packet.IllegalRawDataException;
|
||||
import ru.serega6531.packmate.model.Packet;
|
||||
import ru.serega6531.packmate.service.optimization.tls.TlsPacket;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
public class TlsPacketTest {
|
||||
|
||||
@Test
|
||||
public void testHandshake() throws IOException, IllegalRawDataException {
|
||||
List<Packet> packets = new PackmateDumpFileLoader("tls-wolfram.pkmt").getPackets();
|
||||
|
||||
for (int i = 0; i < packets.size(); i++) {
|
||||
Packet packet = packets.get(i);
|
||||
System.out.println("Packet " + i + ", incoming: " + packet.isIncoming());
|
||||
byte[] content = packet.getContent();
|
||||
TlsPacket tlsPacket = TlsPacket.newPacket(content, 0, content.length);
|
||||
System.out.println(tlsPacket.toString());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user