Friday 12 January 2018

gnupg - Force gpg to use compression?


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.



Answer



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.


No comments:

Post a Comment

Where does Skype save my contact's avatars in Linux?

I'm using Skype on Linux. Where can I find images cached by skype of my contact's avatars? Answer I wanted to get those Skype avat...