Compression Algorithm option for python-gnupg

83 views
Skip to first unread message

Low Kim Hoe

unread,
May 3, 2023, 10:22:39 AM5/3/23
to python-gnupg
Hi All,

May I ask any parameter we can set the compression algorithm
when we encrypt the file?

Thanks

Vinay Sajip

unread,
May 3, 2023, 10:27:05 AM5/3/23
to python-gnupg
No, encryption and compression are orthogonal. Compress your data before encrypting it, or vice versa - it doesn't matter, as long as you reverse the order of operations when decompressing/decrypting.

Low Kim Hoe

unread,
May 8, 2023, 1:08:47 AM5/8/23
to python-gnupg
Hi Vinay,

I have found this option, --compress-algo under the GNUPG software.

We can select the preference compression format with this option by running GNUPG command.
example: gpg --encrypt --recipient "key_id_public_key" --compress-algo zip "file_name"
Do you mean that python-gnupg library doesnt support for this option?

Thanks

Vinay Sajip

unread,
May 8, 2023, 1:39:45 PM5/8/23
to python-gnupg
Oh, I see. Yes, you can pass extra arguments to gpg using the extra_args parameter - for example,

result = gpg.encrypt(..., extra_args = ['--compress-algo', 'zip'])

Low Kim Hoe

unread,
May 11, 2023, 1:50:40 AM5/11/23
to python-gnupg
Sorry for late reply and yes this is working for me.

thank you so much for helping

Vinay Sajip

unread,
May 11, 2023, 10:53:56 AM5/11/23
to python-gnupg
Glad it worked for you!
Reply all
Reply to author
Forward
0 new messages