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 -
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.
Permission issue is taken care of.
gpg agent is running. Getting process id for pgp gpg-agent command.
-
cs_gpg_options = ['--pinentry-mode loopback'] gpg = gnupg.GPG(homedir='~/.gnupg', options=cs_gpg_options, verbose=True) -
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.