FreshmenProgrammer
Programmer
Hello, I would first like to say Thanks in advance for reading this and trying to help me. Ive been stuck for a good 4 hours. I have an app that has to GZIP a token then encrypt it and then Base 64 it and another app to do the opposite.
here is the code that GZIP's it then encrypts it and then base 64.
Here is the app that take it apart but thats not working either
Something is majorly wrong and I don't see it.. Thank you again. This is my error.
here is the code that GZIP's it then encrypts it and then base 64.
Code:
ByteArrayOutputStream out = new ByteArrayOutputStream();
GZIPOutputStream g = new GZIPOutputStream(out);
StringBuffer buf = new StringBuffer();
g.write(buf.toString().getBytes());
g.finish();
Base64 b = new Base64();
String eDataEncrypted = tripleDes.encrypt3(out.toString(), KEY);
String eData = new String(b.encode(eDataEncrypted.getBytes()));
Code:
Base64 bb = new Base64();
String deCode = new String(bb.decode(eData.getBytes()));
String decrypted = (tripleDes.decrypt3(deCode, KEY));
ByteArrayInputStream in = new ByteArrayInputStream(decrypted.getBytes());
ByteArrayOutputStream out = new ByteArrayOutputStream();
GZIPInputStream g = new GZIPInputStream(in);
int i;
while ((i = g.read()) != -1 ) {
out.write(i);
}
g.close();
System.out.println("Decompressed: " + out.toString());
Something is majorly wrong and I don't see it.. Thank you again. This is my error.
Code:
java.util.zip.ZipException: oversubscribed literal/length tree
java.util.zip.InflaterInputStream.read(Unknown Source)
java.util.zip.GZIPInputStream.read(Unknown Source)
java.util.zip.InflaterInputStream.read(Unknown Source)