gpg - decrypt generating zero byte output

37 Views Asked by At

In Python, trying to decrypt a file using gnupg.

Using 'import gnupg'. (NOT python-gnupg).

Getting error message - (gnupg:FAILURE status emitted from gpg process: decrypt 4294967295") AND its not decrypting the file. Generating 0 byte output file.

gpg --version >> 2.2.27

Debug info/Hints -

  1. After importing private key, I get fingerprint. However, gpg --list-key gives output "/root/.gnupg/pubring.gpg". gpg --list-secret-keys, does not give any output.

  2. Permission issue is taken care of.

  3. gpg agent is running. Getting process id for pgp gpg-agent command.

  4. cs_gpg_options = ['--pinentry-mode loopback']
    gpg = gnupg.GPG(homedir='~/.gnupg', options=cs_gpg_options, verbose=True)
    
  5. with open('test_encrypted.csv.gpg', 'rb') as f:
        decrypted_data = gpg.decrypt_file(
          f,
          passphrase='XXX_1234',
          output='check123.csv')
    

gpg.decrypt() has also been tried but issue persists.

Any pointers, kindly share.

0

There are 0 best solutions below