if you revert this i will revert your revert

This commit is contained in:
Daniella / Tove 2023-11-16 20:22:57 +01:00
parent 89dbe112bf
commit bbedab9fec
Signed by: TudbuT
GPG key ID: B3CF345217F202D3

View file

@ -191,34 +191,30 @@ public class ClientHandler extends Thread {
if (result >= 0 || result == -2) { if (result >= 0 || result == -2) {
System.out.println("Client is valid"); System.out.println("Client is valid");
dos.writeInt(result); dos.writeInt(result);
Map<Map<String, byte[]>, byte[]> data = new HashMap<>();
Map<String, byte[]> data = new HashMap<>();
JarInputStream jar = new JarInputStream(new ByteArrayInputStream(SocketHandler.clientFileData)); JarInputStream jar = new JarInputStream(new ByteArrayInputStream(SocketHandler.clientFileData));
ZipEntry zentry; ZipEntry zentry;
while ((zentry = jar.getNextEntry()) != null) { while ((zentry = jar.getNextEntry()) != null) {
Map<String, byte[]> dataLocal = new HashMap<>(); data.put(zentry.getName(), getBytes(jar));
byte[] keyData = SecureRandom.getSeed(1024);
dataLocal.put(zentry.getName(), new Key(keyData).encryptByte(getBytes(jar)));
data.put(dataLocal, keyData);
} }
dos.writeInt(data.size()); dos.writeInt(data.size());
for (Map.Entry<Map<String, byte[]>, byte[]> mapEntry : data.entrySet()) { for (Map.Entry<String, byte[]> entry : data.entrySet()) {
//For the love of all that is holy YOU DO NOT TOUCH THIS CODE TUD //For the love of all that is holy YOU DO NOT TOUCH THIS CODE TUD // i did.
Map.Entry<String, byte[]> entry = mapEntry.getKey().entrySet().iterator().next(); byte[] cryptKey = SecureRandom.getSeed(1024);
String className = entry.getKey(); //Name String className = entry.getKey(); //Name
byte[] classData = entry.getValue(); //Data byte[] classData = entry.getValue(); //Data
byte[] cryptKey = mapEntry.getValue(); //Key
byte[] encryptedBytes1 = key.encryptByte(aesE.doFinal(className.getBytes())); byte[] encryptedBytes1 = key.encryptByte(aesE.doFinal(className.getBytes()));
dos.writeUTF(Base64.getEncoder().encodeToString(encryptedBytes1)); 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)); dos.writeUTF(Base64.getEncoder().encodeToString(encryptedBytes2));
byte[] encryptedBytes3 = key.encryptByte(aesE.doFinal(cryptKey)); byte[] encryptedBytes3 = key.encryptByte(aesE.doFinal(cryptKey));