When encrypting a file symmetrically with gpg -c file.txt
, when and how does it compress the file?
I was working on a cryptopals challenge and wanted to test out my AES ECB detection function. I made a simple text-file that was around 1KB and encrypted it through the python package PyCrypto, the output file was also 1KB. I took this same file and encrypted it via gpg
and got a file that was only 100B. My ECB detection function completely failed to tell it was 128 AES-ECB.
Edit: I've noticed that no matter the file, when the contents are encoded to b64 the first string is always jA0EBwMC
, yet even removing these first bytes from the data doesn't yield any repeat blocks.
I tried to decompress the file with bz2
, but it put out an error saying it wasn't a bzip2 file. I also can't tell if the file was compressed before the cipher was applied or before. How can you deal with something like this?
-z
. It says the default is to the level of zlip. It doesn't tell me if it's done before or after encryption, and it also doesn't help me "undo" it. I've tried to decompress the file the usual ways, but nothing seems to work. $\endgroup$ – Astrum Mar 17 '17 at 11:14gpg
supports zip, zlib and bzip2. Compression is always done before encryption because afterwards you have uncompressable random-looking data. $\endgroup$ – SEJPM♦ Mar 17 '17 at 12:00