How to sign a file and then verify?

I am writing an application in which I synchronize a file with a server, where I want to sign the file, and then send it back to the client, where it can be checked.

It seems that for Python for Ubuntu / Debian there are several gnupg modules for:

python-gnupginterface - Python interface for GnuPG (GPG)

python-gpgme - python shell for GPGME library

python-gpgme-dbg - python shell for GPGME library (debug extension)

python-pyme - Python interface for GPGME GnuPG library for encryption

python-pyme-doc - Python interface for the GPGME GnuPG library for encryption

Can someone recommend which one I should use, which quickly launches me?

Should I just disable gpg instead of using a Python module?

Thank!

+5
2

python-gpgme ( , , ).

, - ( jamesh, , ):

import gpgme
from io import BytesIO

ctx = gpgme.Context()
plain = BytesIO("Hello")
sign = BytesIO("")

ctx.sign(plain, sign, gpgme.SIG_MODE_CLEAR)
print sign.getvalue()

, BytesIO - . file("/etc/passwd") sys.stdout , DWYW.

+2

All Articles