Skip to content

ValueError: MODE_OPENPGP requires an IV #17

@pts

Description

@pts

When trying to decrypt a symmetric key encrypted PGP message, I'm getting the error ValueError: MODE_OPENPGP requires an IV. Am I using it correctly?

$ unzip example.bin.gpg.zip
$ python3 -c 'import pgp; m = pgp.read_message(
      open("example.bin.gpg", "rb").read()); g = m.get_message("abc");
      print([g]); print([g.data])'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/python-pgp/pgp/message.py", line 613, in get_message
    return self.message_data_obj.decrypt(sym_algo, sess_key)
  File "/tmp/tinygpgs/python-pgp/pgp/message.py", line 487, in decrypt
    encrypted_iv)
  File "/tmp/python-pgp/pgp/utils.py", line 294, in get_symmetric_cipher
    segment_size=segment_size)
  File "/usr/lib/python3/dist-packages/Crypto/Cipher/CAST.py", line 103, in new
    return CAST128Cipher(key, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/Crypto/Cipher/CAST.py", line 68, in __init__
    blockalgo.BlockAlgo.__init__(self, _CAST, key, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/Crypto/Cipher/blockalgo.py", line 155, in __init__
    raise ValueError("MODE_OPENPGP requires an IV")
ValueError: MODE_OPENPGP requires an IV

I'm using Python 3.5.3 and PyCrypto 2.6.1 on Debian 9: sudo apt-get install python3-crypto. I'm using python-pgp at commit 62a3da5.

The example file is example.bin.gpg.zip, the passphrase is abc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions