I have written a program that encrypts a given jar file. Quite straight forward. Now I'm in the process of writing a second program that decrypts the file by bruteforcing it. (They are both standalone)
After encrypting a given file I end up with a byte[] containing the encrypted file data. I converted this byte[] to a String and made it output to the console so I could easily copy and paste the data.
Then I initializing a new String in the 'decrypter' and pasted this data of the encrypted file. For small files this works, but for larger files it doesn't work due to the String literal size limit. How can I hardcode this data into the decrypter?
Quick pseudo-code
Encrypter:
public byte[] encrypt(){
}
String encryptedData = Arrays.toString(encrypt(data));
Decrypter:
String encryptedData = "[-3, -66, -89, -14, 5, -72, 12, 5, ........
// note that I actually copy paste - hardcode the string
decrypt(stringToByteArray(encryptedData));
I can not use a temp file to read/write between both programs.