You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/scenarios/crypto.rst
+19-16Lines changed: 19 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -45,6 +45,8 @@ GPGME bindings
45
45
46
46
The `GPGME Python bindings <https://dev.gnupg.org/source/gpgme/browse/master/lang/python/>`_ provide pythonic access to `GPG Made Easy <https://dev.gnupg.org/source/gpgme/browse/master/>`_, a C API for the entire GNU Privacy Guard suite of projects, including GPG, libgcrypt and gpgsm (the S/MIME engine). It supports Python 2.6, 2.7, 3.4 and above. Depends on the SWIG C interface for Python as well as the GnuPG software and libraries.
47
47
48
+
A more comprehensive `GPGME Python Bindings HOWTO <https://dev.gnupg.org/source/gpgme/browse/master/lang/python/docs/GPGMEpythonHOWTOen.org>`_ is available with the source and a HTML version is available `here <http://files.au.adversary.org/crypto/GPGMEpythonHOWTOen.html>`_. Python 3 sample scripts from the examples in the HOWTO are also provided with the source and are accessible `here <https://dev.gnupg.org/source/gpgme/browse/master/lang/python/examples/howto/>`_.
49
+
48
50
Available under the same terms as the rest of the GnuPG Project: GPLv2 and LGPLv2.1, both with the "or any later version" clause.
49
51
50
52
Installation
@@ -58,27 +60,28 @@ Example
58
60
.. code-block:: python3
59
61
60
62
import gpg
61
-
import os
62
63
63
64
# Encryption to public key specified in rkey.
64
-
rkey = "0xDEADBEEF"
65
-
text = "Something to hide."
66
-
plain = gpg.core.Data(text)
67
-
cipher = gpg.core.Data()
68
-
c = gpg.core.Context()
69
-
c.set_armor(1)
70
-
c.op_keylist_start(rkey, 0)
71
-
r = c.op_keylist_next()
72
-
c.op_encrypt([r], 1, plain, cipher)
73
-
cipher.seek(0, os.SEEK_SET)
74
-
ciphertext = cipher.read()
75
-
65
+
a_key = input("Enter the fingerprint or key ID to encrypt to: ")
66
+
filename = input("Enter the filename to encrypt: ")
0 commit comments