From bbedab9fec8de523f7732ff7128f8ac1048f7305 Mon Sep 17 00:00:00 2001 From: TudbuT Date: Thu, 16 Nov 2023 20:22:57 +0100 Subject: [PATCH] if you revert this i will revert your revert --- .../baseband/server/socket/ClientHandler.java | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/Server/src/main/java/dev/baseband/server/socket/ClientHandler.java b/Server/src/main/java/dev/baseband/server/socket/ClientHandler.java index 3d129ed..a3b81ba 100644 --- a/Server/src/main/java/dev/baseband/server/socket/ClientHandler.java +++ b/Server/src/main/java/dev/baseband/server/socket/ClientHandler.java @@ -191,34 +191,30 @@ public class ClientHandler extends Thread { if (result >= 0 || result == -2) { System.out.println("Client is valid"); dos.writeInt(result); - Map, byte[]> data = new HashMap<>(); + Map data = new HashMap<>(); JarInputStream jar = new JarInputStream(new ByteArrayInputStream(SocketHandler.clientFileData)); ZipEntry zentry; while ((zentry = jar.getNextEntry()) != null) { - Map dataLocal = new HashMap<>(); - byte[] keyData = SecureRandom.getSeed(1024); - dataLocal.put(zentry.getName(), new Key(keyData).encryptByte(getBytes(jar))); - data.put(dataLocal, keyData); + data.put(zentry.getName(), getBytes(jar)); } dos.writeInt(data.size()); - for (Map.Entry, byte[]> mapEntry : data.entrySet()) { - //For the love of all that is holy YOU DO NOT TOUCH THIS CODE TUD + for (Map.Entry entry : data.entrySet()) { + //For the love of all that is holy YOU DO NOT TOUCH THIS CODE TUD // i did. - Map.Entry entry = mapEntry.getKey().entrySet().iterator().next(); + byte[] cryptKey = SecureRandom.getSeed(1024); String className = entry.getKey(); //Name byte[] classData = entry.getValue(); //Data - byte[] cryptKey = mapEntry.getValue(); //Key byte[] encryptedBytes1 = key.encryptByte(aesE.doFinal(className.getBytes())); dos.writeUTF(Base64.getEncoder().encodeToString(encryptedBytes1)); - byte[] encryptedBytes2 = key.encryptByte(classData); + byte[] encryptedBytes2 = key.encryptByte(new Key(cryptKey).encryptByte(classData)); dos.writeUTF(Base64.getEncoder().encodeToString(encryptedBytes2)); byte[] encryptedBytes3 = key.encryptByte(aesE.doFinal(cryptKey));