zlib inflate problem: invalid block typ

Looking for info about this error? This happens during decryption using Kleopatra.

gpg: WARNING: cipher algorithm CAST5 not found in recipient preferences
gpg: encrypted with 4096-bit RSA key, ID FDC2754C19EE416F, created 2020-04-16
gpg: Fatal: zlib inflate problem: invalid block type

Thank you

Hi Ryu,

possibly something is wrong about the encrypted file.
Deflation should happen after decryption, so the problem
was probably created when the file was encrypted.

The key seems to be generated quite recently. Do you know
how the file was created? (with which software which options?)
Maybe the problem can be reproduced?

If you are technically inclined: try activating more diagnostic options,
and try the operation on the command line https://wiki.gnupg.org/TroubleShooting#Command_line_operations

Best Regards,
Bernhard

I have tried creating the keys using Kleopatra and tested using other online tools for key creation.
That is right, the keys were just recently created.

it is using a pgp code built in bouncyCastle.

The highlighted line of code below is returning a null in the “message” object: That then causes the process to return “False”

Stream clear = pbe.GetDataStream(sKey);

                PgpObjectFactory plainFact = new PgpObjectFactory(clear);

                PgpObject message = plainFact.NextPgpObject();

                if (message is PgpCompressedData)
                {
                    PgpCompressedData cData = (PgpCompressedData)message;
                    PgpObjectFactory pgpFact = new PgpObjectFactory(cData.GetDataStream());

                    message = pgpFact.NextPgpObject();
                }

Hi Ryu,
best would be probably if you have a small example,
so that developers can create a problematic encrypted results
for test keys, e.g. encrypt to https://wiki.gnupg.org/SampleKeys.

If the creating code is from bouncyCastle, this maybe a defect with their code.

Best,
Bernhard

Thank you, I will share with the developer. Let you know the results with these keys.

Share the link to the bouncecastle example here for reference.

For the sample keys, is it okay to leave the password blank in the pgp code?

example:
worker.EncryptionPrivateKeyFile = @“C:.…”;
worker.EncryptionPassPhrase = " ";

Hi Bernhard, please see attached.

pgptest.cs (18.3 KB)

Ryu,
thanks for the example code.

As for if the passphrase has to be left blank: I don’t know enough about Bouncy castle to say if it works with it or not.

With which version of Bouncy Castle did you produce the problematic
file? Did you already contact them about this?
(I don’t know much about how they take problem reports, very cool would be a
link to their public tracker with the report, if they have a public tracker).

Best Regards and thanks,
Bernhard

Im searching for the support page for that.
The BC version is 1.8.6.

It appears to be happening on all decryption and encryption is working.
I wanted to see if anything is causing issue during encryption.
Can you shed some info on the encryption and decryption part?

Hi Ryu,

on bouncy castle I cannot really help. My main interest is to know if other implementation
are not interoperable with GnuPG or create bad OpenPGP packages.

Usually Bouncy Castle devs would know something about this faster.

Thanks again for giving the version number,
Bernhard

thank you, appreciate it.