SecurityInnovation / PGPy

Pretty Good Privacy for Python
BSD 3-Clause "New" or "Revised" License
313 stars 98 forks source link

GnuPG version 2.3.8 encrypted files - NotImplementedError: <class 'pgpy.packet.types.Opaque'> error during decryption #426

Open nrvikas opened 1 year ago

nrvikas commented 1 year ago

Hi Maintainers

I have encrypted a file with GnuPG version 2.3.8. And it fails during decryption with the following error:

` pgp_message = pgpy.PGPMessage.from_blob(binary_message) File "/usr/local/lib/python3.10/site-packages/pgpy/types.py", line 203, in from_blob po = obj.parse(bytearray(blob)) File "/usr/local/lib/python3.10/site-packages/pgpy/pgp.py", line 1281, in parse self |= Packet(data) File "/usr/local/lib/python3.10/site-packages/pgpy/pgp.py", line 1068, in or raise NotImplementedError(str(type(other)))

`

Message: -----BEGIN PGP MESSAGE-----

hF4DAwzhzwoKW90SAQdAb1GaTD+NOzZECOyHchnuolomkIXl5MDSoY/8CS588CYw SqFzctnsgv+sXajwjT7/zPzKhFv/Qx48LG8TMlnL2gtokxGluy0wlH5P5EFrtlLU 1MCdAQkCEFr+Yq70WFH4gblv+pGXtlY19AFLc/GZid0dWlmnnILaYqD7UMbNqs2F 4wSGG8ZG3zcskG+5HdX/D7Hs3qbvLlt7szY3qfy8Swv5J+zlK2b0Udp4g46+/Nl2 SQ7M5+tllXwWrmYZsE8DuowawNrxTJu9yN/7be1tC2ZPo8Y1vjeJ/BDHUvDpNFW5 X5ZSkmBH9OzwBaVi+Zp2H2Dv3AL1iOc7fK4Zzw3yIpxSUIwH6VVMMZUWaKvJxLrD P9r7pWhl779zUSPD9PErIbuAT/s0tL/Nupws6s6g9wofwrG1zwjjAsRjwVs5JA6e qQisHvM7gmYm7bW87d7OhyJ4uuTmRG294AeJPPmNYNbW48wQgtZssyByyfPsy2q+ aiKViAzZPjQlcMs04Jt8yH5ik+vjOGSqIWjS7b3tg6mP/ECzG9v6kF0HPqAtAQeC fXWCSs5zLuKqxghUwWcR6A== =0XxT -----END PGP MESSAGE-----

Private key: -----BEGIN PGP PRIVATE KEY BLOCK-----

lIYEY4QrLBYJKwYBBAHaRw8BAQdAhEInjrDgMU4VILpoAdRrPa4yF4FHHQ6q1HpR 8l/wjqf+BwMC6Ug5yuB9I2bz8s+YsR2k4S+CKxZqk2DazZSCaNf/+888xNecQ7Gv oNZx1tPgCH3/samnm0fJBq73rgdCsaE0I00rnLIyn53p5H7XINac9rQgd2hhdGV2 ZXIgPHdoYXRldmVyQHdoYXRldmVyLmNvbT6ImQQTFgoAQRYhBEDY+SAC3VnjEWo4 QK3N6lNw7WOzBQJjhCssAhsDBQkDwmcABQsJCAcCAiICBhUKCQgLAgQWAgMBAh4H AheAAAoJEK3N6lNw7WOzJQIBAJS6vzoJ0vz5bMcAuBzCFSox3+WmSZhdcytj7uwf dn/GAQDG9BqYbftr2hOabO0UAJ/YxJXbtUA8AwuvPu6nGbrjBZyLBGOEKywSCisG AQQBl1UBBQEBB0CaciC+SpgLsGNkafaczzv4CtBrbQlsbldEuIcJ+BjfdAMBCAf+ BwMCEwmYomcxZCHzpCrtrilF4TdbRYUycyAUMsVYDgDLCIa3/RX4gPoQJxQ18/S8 myKfNzYMuUrtTcJcV22xeRjY6NuS1wGOyedvF8oOeonYxoh+BBgWCgAmFiEEQNj5 IALdWeMRajhArc3qU3DtY7MFAmOEKywCGwwFCQPCZwAACgkQrc3qU3DtY7PNegEA pScjj8FxzGMwqdiG5BubIAvzsp5lSqNPfnnG/EhhWWoA/1JyqBMRH8O5Sbw3qSv6 6PYaUR0BHZuWnigTiXDF0N8P =3E7g -----END PGP PRIVATE KEY BLOCK-----

Note it works fine on a lower version of GnuPG - 2.2.23. Is this a bug in PGPy library ?

Please let me know if any other information is needed.

nrvikas commented 1 year ago

Hi @Commod0re - can I request your help here please ?

nrvikas commented 1 year ago

Just reaching out to check if we can expect any activity on the issue raised almost 2 months ago. @Commod0re @KOLANICH @dkg - can one of you please look into this issue ? GnuPG is a standard software used by people and the files encrypted using the latest version of GnuPG breaks the PgPy package during decryption. Please let me know if you need any further information.

KOLANICH commented 1 year ago

I'm sorry, I'm a bit busy now (and I'm not really a maintainer of this project, just a contributor), so for now I cannot afford to help you.

nrvikas commented 1 year ago

I'm sorry, I'm a bit busy now (and I'm not really a maintainer of this project, just a contributor), so for now I cannot afford to help you.

Thanks @KOLANICH - appreciate your response. If I have not already tagged the maintainer and you know who it is, please help tag (if you don't mind). If I have already done it, please ignore. Thanks again for your help :)

dkg commented 1 year ago

@nrvikas, i am also not a maintainer of this project, just a contributor.

Looking at the packets you're sending, they appear to be based on GnuPG's extensions to the OpenPGP wire format, which have not been formally standardized. In particular, they use the proposed "AEAD" packet format, which has never reached consensus of the IETF OpenPGP working group. The pending draft standard supports AEAD ciphertext in the "SEIPDv2" format, but not in the structure that GnuPG has pushed ahead with.

I'm one of the people trying to coordinate that standardization effort. I have no idea whether the PGPy project will adopt GnuPG-specific formats, but i do hope that it will eventually adopt the standard that the OpenPGP working group settles on (i also hope that GnuPG will do the same as well)