[git] GPGME - branch, ben/docs/2018-03, updated. gpgme-1.10.0-93-g5432e5f
by Ben McGinnes
cvs at cvs.gnupg.org
Thu Mar 15 04:02:50 CET 2018
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GnuPG Made Easy".
The branch, ben/docs/2018-03 has been updated
via 5432e5f9d1dfc02812d0b181f8d88cdf4a2bfbfb (commit)
via 5d1dd2abe5cf787875d12afe46c78c75385d7b31 (commit)
from 1d05e6aa4ea467c8c5926b827cfcfba357d03312 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 5432e5f9d1dfc02812d0b181f8d88cdf4a2bfbfb
Author: Ben McGinnes <ben at adversary.org>
Date: Thu Mar 15 14:01:30 2018 +1100
doc: python bindings howto
* generated a new primary key for Danger Mouse in an alternative homedir.
diff --git a/lang/python/docs/GPGMEpythonHOWTOen.org b/lang/python/docs/GPGMEpythonHOWTOen.org
index af5a18c..909d949 100644
--- a/lang/python/docs/GPGMEpythonHOWTOen.org
+++ b/lang/python/docs/GPGMEpythonHOWTOen.org
@@ -1068,12 +1068,105 @@
disabling them, sometimes deleting them and doing the same for user
IDs.
+ In the following examples a key will be created for the world's
+ greatest secret agent, Danger Mouse. Since Danger Mouse is a secret
+ agent he needs to be able to protect information to =SECRET= level
+ clearance, so his keys will be 3072-bit keys.
+
** Primary key
:PROPERTIES:
:CUSTOM_ID: keygen-primary
:END:
+ Generating a primary key uses the =create_key= method in a Context.
+ It contains multiple arguments and keyword arguments, including:
+ =userid=, =algorithm=, =expires_in=, =expires=, =sign=, =encrypt=,
+ =certify=, =authenticate=, =passphrase= and =force=. The defaults
+ for all of those except =userid=, =algorithm=, =expires_in=,
+ =expires= and =passphrase= is =False=. The defaults for
+ =algorithm= and =passphrase= is =None=. The default for
+ =expires_in= is =0=. The default for =expires= is =True=. There
+ is no default for =userid=.
+
+ If =passphrase= is left as =None= then the key will not be
+ generated with a passphrase, if =passphrase= is set to a string
+ then that will be the passphrase and if =passphrase= is set to
+ =True= then gpg-agent will launch pinentry to prompt for a
+ passphrase. For the sake of convenience, these examples will keep
+ =passphrase= set to =None=.
+
+ #+begin_src python
+ import gpg
+
+ c = gpg.Context()
+
+ c.home_dir = "/tmp/dmgpg"
+ userid = "Danger Mouse <dm at secret.example.net>"
+
+ dmkey = c.create_key(userid, algorithm = "rsa3072", expires_in = 31536000,
+ sign = True, certify = True)
+ #+end_src
+
+ One thing to note here is the use of setting the =c.home_dir=
+ parameter. This enables generating the key or keys in a different
+ location. In this case to keep the new key data created for this
+ example in a separate location rather than adding it to existing
+ and active key store data.
+
+ The successful generation of the key can be confirmed via the
+ returned =GenkeyResult= object, which includes the following data:
+
+ #+begin_src python
+ print("""
+ Fingerprint: {0}
+ Primary Key: {1}
+ Public Key: {2}
+ Secret Key: {3}
+ Sub Key: {4}
+ User IDs: {5}
+ """.format(dmkey.fpr, dmkey.primary, dmkey.pubkey, dmkey.seckey, dmkey.sub,
+ dmkey.uid))
+ #+end_src
+
+ Alternatively the information can be confirmed using the command
+ line program:
+
+ #+begin_src shell
+ bash-4.4$ gpg --homedir /tmp/dmgpg -K
+ /tmp/dmgpg/pubring.kbx
+ ----------------------
+ sec rsa3072 2018-03-15 [SC] [expires: 2019-03-15]
+ 177B7C25DB99745EE2EE13ED026D2F19E99E63AA
+ uid [ultimate] Danger Mouse <dm at secret.example.net>
+
+ bash-4.4$
+ #+end_src
+
+ As with generating keys manually, to preconfigure expanded
+ preferences for the cipher, digest and compression algorithms, the
+ =gpg.conf= file must contain those details in the home directory in
+ which the new key is being generated. I used a cut down version of
+ my own =gpg.conf= file in order to be able to generate this:
+
+ #+begin_src shell
+ bash-4.4$ gpg --homedir /tmp/dmgpg --edit-key 177B7C25DB99745EE2EE13ED026D2F19E99E63AA showpref quit
+ Secret key is available.
+
+ sec rsa3072/026D2F19E99E63AA
+ created: 2018-03-15 expires: 2019-03-15 usage: SC
+ trust: ultimate validity: ultimate
+ [ultimate] (1). Danger Mouse <dm at secret.example.net>
+
+ [ultimate] (1). Danger Mouse <dm at secret.example.net>
+ Cipher: TWOFISH, CAMELLIA256, AES256, CAMELLIA192, AES192, CAMELLIA128, AES, BLOWFISH, IDEA, CAST5, 3DES
+ Digest: SHA512, SHA384, SHA256, SHA224, RIPEMD160, SHA1
+ Compression: ZLIB, BZIP2, ZIP, Uncompressed
+ Features: MDC, Keyserver no-modify
+
+ bash-4.4$
+ #+end_src
+
** Subkeys
:PROPERTIES:
commit 5d1dd2abe5cf787875d12afe46c78c75385d7b31
Author: Ben McGinnes <ben at adversary.org>
Date: Thu Mar 15 12:27:45 2018 +1100
doc: python bindings howto
* Added sections for key generation and key editing.
diff --git a/lang/python/docs/GPGMEpythonHOWTOen.org b/lang/python/docs/GPGMEpythonHOWTOen.org
index 8f57adb..af5a18c 100644
--- a/lang/python/docs/GPGMEpythonHOWTOen.org
+++ b/lang/python/docs/GPGMEpythonHOWTOen.org
@@ -1057,6 +1057,48 @@
#+end_src
+* Creating keys and subkeys
+ :PROPERTIES:
+ :CUSTOM_ID: key-generation
+ :END:
+
+ The one thing, aside from GnuPG itself, that GPGME depends on, of
+ course, is the keys themselves. So it is necessary to be able to
+ generate them and modify them by adding subkeys, revoking or
+ disabling them, sometimes deleting them and doing the same for user
+ IDs.
+
+
+** Primary key
+ :PROPERTIES:
+ :CUSTOM_ID: keygen-primary
+ :END:
+
+
+** Subkeys
+ :PROPERTIES:
+ :CUSTOM_ID: keygen-subkeys
+ :END:
+
+
+** User IDs
+ :PROPERTIES:
+ :CUSTOM_ID: keygen-uids
+ :END:
+
+
+** Key preferences
+ :PROPERTIES:
+ :CUSTOM_ID: keygen-prefs
+ :END:
+
+
+** Key certification
+ :PROPERTIES:
+ :CUSTOM_ID: keygen-certify
+ :END:
+
+
* Miscellaneous work-arounds
:PROPERTIES:
:CUSTOM_ID: cheats-and-hacks
-----------------------------------------------------------------------
Summary of changes:
lang/python/docs/GPGMEpythonHOWTOen.org | 135 ++++++++++++++++++++++++++++++++
1 file changed, 135 insertions(+)
hooks/post-receive
--
GnuPG Made Easy
http://git.gnupg.org
More information about the Gnupg-commits
mailing list