doc: python bindings howto
* Added text description for the decryption example.
This commit is contained in:
parent
f81adeba99
commit
c27a7a3f99
@ -451,9 +451,14 @@
|
|||||||
:CUSTOM_ID: howto-basic-encryption
|
:CUSTOM_ID: howto-basic-encryption
|
||||||
:END:
|
:END:
|
||||||
|
|
||||||
Decrypting something encrypted to a key in one's secret keyring
|
Decrypting something encrypted to a key in one's secret keyring is
|
||||||
(will display some extra data you normally wouldn't show, but which
|
fairly straight forward.
|
||||||
may be of use):
|
|
||||||
|
In this example code, however, preconfiguring either
|
||||||
|
=gpg.Context()= or =gpg.core.Context()= as =c= is unnecessary
|
||||||
|
because there is no need to modify the Context prior to conducting
|
||||||
|
the decryption and since the Context is only used once, setting it
|
||||||
|
to =c= simply adds lines for no gain.
|
||||||
|
|
||||||
#+begin_src python
|
#+begin_src python
|
||||||
import os.path
|
import os.path
|
||||||
@ -481,6 +486,11 @@
|
|||||||
pass
|
pass
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
|
The data available in plaintext in this example is the decrypted
|
||||||
|
content as a byte object in =plaintext[0]=, the recipient key IDs
|
||||||
|
and algorithms in =plaintext[1]= and the results of verifying any
|
||||||
|
signatures of the data in =plaintext[0]=.
|
||||||
|
|
||||||
|
|
||||||
** Signing text
|
** Signing text
|
||||||
:PROPERTIES:
|
:PROPERTIES:
|
||||||
@ -550,7 +560,7 @@
|
|||||||
#+begin_src python
|
#+begin_src python
|
||||||
import gpg
|
import gpg
|
||||||
|
|
||||||
tfile = open("/path/to/statement.txt", "r")
|
tfile = open("/path/to/statement.txt", "rb")
|
||||||
text = tfile.read()
|
text = tfile.read()
|
||||||
tfile.close()
|
tfile.close()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user