Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Odd situation, and I won't go into details about why our present circumstances require it. But, I'm looking for a way to force gpg to use compression. My testing is suggesting that the following command ignores the '-z' option:

gpg -z 6 -e test.zip

Note that the object to be encrypted is a zip archive. I'm using the bouncycastle java library to crack open output blob and it doesn't appear to be using pgp-compression.

My suspicion is that gpg detects that the file to be encrypted is already compressed and doesn't re-compress it. Unfortunately that's precisely what I need it to do.

Can anyone confirm this is the case (gpg doesn't re-compress)? And if so, is there a way to force it? Thanks.

share|improve this question
    
Why would you want to compress an already compressed file. The results may result in a file significantly larger than the original! –  mdpc Jul 17 '13 at 19:06
    
Agreed - it is a silly thing to need. But I need it :) –  pedorro Jul 17 '13 at 19:15
    
Using -v with your command shows your suggest is right; neither the man page nor the esoteric options manual know anything about enforcing compression of compressed contents. Probably you're out of luck. –  Jens Erat Jul 17 '13 at 19:23
add comment

1 Answer

up vote 3 down vote accepted

If you look at the relevant source file (encode.c; search for is_file_compressed), GPG will still do the compression if MDC is disabled. So passing --disable-mdc should do the trick.

If you don't want to disable MDC, then you should probably compile your own copy of GPG with the compression check removed.

share|improve this answer
    
Thanks - I was about to post this answer myself :) –  pedorro Jul 18 '13 at 18:56
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.