GPG key generated on Windows and imported on Linux fails to decrypt files on Linux which where encrypted on Windows

Robert Flosbach r.flosbach at
Sat Jan 8 10:01:53 CET 2022

Hello everyone,

I've created a private key on my Windows 10 machine with Gpg4win/Kleopatra
and imported it on my Linux machine. Now, when I encrypt files with Gpg4win
on Windows (via Kleopatra) and try to decrypt them on a Linux machine, I get
the following error:
gpg: [don't know]: partial length invalid for packet type 20

Steps to reproduce:
1) Install Gpg4win 4.0.0 on Windows 10.
2) Generate keypair with default settings on Windows.
3) Export keypair and import it on a Linux machine.
4) Encrypt a file on Windows, copy it on the Linux machine and try to
decrypt it [1].

Some more information:
1) The other way round (signing/encrypting on Linux and verifying/decrypting
on Windows) works without a problem.
2) Also signing/encrypting on Linux and verifying/decrypting on Linux works
without a problem.
2) I used a plain Windows 10 VM and a plain Ubuntu 20.04 VM to reproduce the
bug so exclude configuration problems.
3) On Windows I use: Gpg4win 4.0.0 with GnuPG 2.3.4, Libgcrypt 1.9.4. On
Linux Ubuntu 20.04 and 18.04 I use gpg (GnuPG) 2.2.19, libgcrypt 1.8.5 and
gpg (GnuPG) 2.2.4, libgcrypt 1.8.1.
4) First I thought that the problem was encrypting on Windows and decrypting
on Linux. However, the problem might rather have to do with the key
generation/export/import somehow, because if I generate a private key on
Linux and transfer it to Windows, then I can encrypt files on Windows and
decrypt them on Linux!
5) Importing the key on Linux does not generate any warning or error. And I
can also properly use the keypair generated on Windows to encrypt, decrypt,
sign and verify files between Linux clients without problem. It's just
encrypting on Windows and decrypting on Linux with a keypair generated on a
Windows client.

If anyone of you recognize the problem and has a solution, please tell me
what I did wrong or what I could do to decrypt my files on Linux. Maybe
there are some known incompatibilities that I failed to find while
researching the bug. Otherwise, it would be great to open a bug for this

Kind regards
Robert Flosbach

[1] Verbose commandline output:

gpg -vv --decrypt test.txt.gpg
# off=0 ctb=85 tag=1 hlen=3 plen=524
:pubkey enc packet: version 3, algo 1, keyid E99307B0267B183D
	data: [4094 bits]
gpg: public key is E99307B0267B183D
gpg: using subkey E99307B0267B183D instead of primary key 644B2234DE0FC2F0
gpg: public key encrypted data: good DEK
gpg: [don't know]: partial length invalid for packet type 20

More information about the Gnupg-users mailing list