GPGME FAQ

GnuPG Made Easy (GPGME) is a library designed to make access to GnuPG easier for applications. It provides a High-Level Crypto API for encryption, decryption, signing, signature verification and key management.

Frequently Asked Questions

Why does the function gpgme_data_seek not work?

You probably did not compile the program with largefile support. GPGME is compiled with largefile support by default, so offt is a 64-bit data type. Because gpgme_data_seek uses off_t as a parameter type, you have to compile your program with largefile support as well, so that the data types used by GPGME and by your program match.

Note that you have to compile your program with largefile support even if you do not use gpgme_data_seek, because file descriptors are exchanged between the program and GPGME.

The GPGME documentation contains much more information on the subject. See section 2.3 Largefile support of the GPGME Reference Manual.

Why don't the Python bindings announced in 2016 work?

The Python bindings have been undergoing continual improvement and fine tuning since the initial announcement. To obtain the most accurate bindings it is recommended to install the bindings shipped with GPGME itself rather than older versions available on PyPI.

The Python module has been renamed from pyme or pyme3 and is now simply called gpg. Otherwise the function remains similar and example code is included with the source.

A basic decryption operation to take an encrypted file and decrypt it with a key in your secret keys would look something like this:

import gpg

ciphertext = open("filename.txt.asc", "rb")
plaintext = gpg.Context().decrypt(ciphertext)
ciphertext.close()
f = open("filename.txt", "wb")
f.write(plaintext[0])
f.close()
del plaintext