Search code examples
python-3.xgnupg

Python gnupg not able to verify a detached-signed file


I have detach signed a file using command line and the following command:

gpg --output doc.sig --detach-sig "import json.py"

When I use the following python script to verify the same file using the doc.sig it always returns unverified and I am not sure what I am doing wrong.

Python Script:

import gnupg 
import tempfile



gpg = gnupg.GPG('/usr/local/bin/gpg')

verified = gpg.verify_file('doc.sig','import json.py')


print ("Verified" if verified else "Unverified")

Solution

  • Okay, the answer to the above problem is that you want to make sure you don't have multiple gnupg/gpg installations.

    Just one python-gnupg install.