aboutsummaryrefslogtreecommitdiffstats
path: root/lang/python/docs/GPGMEpythonHOWTOen.org
diff options
context:
space:
mode:
authorBen McGinnes <[email protected]>2018-03-13 08:20:44 +0000
committerBen McGinnes <[email protected]>2018-03-13 08:20:44 +0000
commitc92da2c7eb148ce9fb06495a8470dd9caf662f9a (patch)
tree1c1cb6089edc67a8c48087e9fda9498026949ac7 /lang/python/docs/GPGMEpythonHOWTOen.org
parentdoc: python bindings howto (diff)
downloadgpgme-c92da2c7eb148ce9fb06495a8470dd9caf662f9a.tar.gz
gpgme-c92da2c7eb148ce9fb06495a8470dd9caf662f9a.zip
doc: python bindings howto
* Added key selection for specifying signing key or keys.
Diffstat (limited to 'lang/python/docs/GPGMEpythonHOWTOen.org')
-rw-r--r--lang/python/docs/GPGMEpythonHOWTOen.org25
1 files changed, 17 insertions, 8 deletions
diff --git a/lang/python/docs/GPGMEpythonHOWTOen.org b/lang/python/docs/GPGMEpythonHOWTOen.org
index 5ee3a82b..ea1b7653 100644
--- a/lang/python/docs/GPGMEpythonHOWTOen.org
+++ b/lang/python/docs/GPGMEpythonHOWTOen.org
@@ -532,9 +532,7 @@
:CUSTOM_ID: howto-basic-signing
:END:
- Need to determine whether or not to include clearsigning and
- detached signing here or give them separate sections. Yes, section
- them.
+ X
*** Signing key selection
:PROPERTIES:
@@ -547,6 +545,19 @@
available it may be necessary to specify the key or keys with
which to sign messages and files.
+ #+begin_src python
+ import gpg
+
+ logrus = input("Enter the email address or string to match signing keys to: ")
+ hancock = gpg.Context().keylist(pattern=logrus, secret=True)
+ sig_src = list(hancock)
+ #+end_src
+
+ The signing examples in the following sections include the
+ explicitly designated =signers= parameter in two of the five
+ examples; once where the resulting signature would be ASCII
+ armoured and once where it would not be armoured.
+
*** Normal or default signing messages or files
:PROPERTIES:
:CUSTOM_ID: howto-basic-signing-normal
@@ -559,8 +570,7 @@
"""
- c = gpg.Context()
- c.armor = True
+ c = gpg.Context(armor=True, signers=sig_src)
signed = c.sign(text, mode=0)
afile = open("/path/to/statement.txt.asc", "wb")
@@ -598,8 +608,7 @@
"""
- c = gpg.Context()
- c.armor = True
+ c = gpg.Context(armor=True)
signed = c.sign(text, mode=1)
afile = open("/path/to/statement.txt.asc", "wb")
@@ -617,7 +626,7 @@
text = tfile.read()
tfile.close()
- c = gpg.Context()
+ c = gpg.Context(signers=sig_src)
signed = c.sign(text, mode=1)
afile = open("/path/to/statement.txt.sig", "wb")