aboutsummaryrefslogtreecommitdiffstats
path: root/lang/python/docs/GPGMEpythonHOWTOen.org
diff options
context:
space:
mode:
Diffstat (limited to 'lang/python/docs/GPGMEpythonHOWTOen.org')
-rw-r--r--lang/python/docs/GPGMEpythonHOWTOen.org33
1 files changed, 33 insertions, 0 deletions
diff --git a/lang/python/docs/GPGMEpythonHOWTOen.org b/lang/python/docs/GPGMEpythonHOWTOen.org
index 0b882b55..4385bc9b 100644
--- a/lang/python/docs/GPGMEpythonHOWTOen.org
+++ b/lang/python/docs/GPGMEpythonHOWTOen.org
@@ -498,6 +498,39 @@
#+end_src
+* Working with keys
+ :PROPERTIES:
+ :CUSTOM_ID: howto-keys
+ :END:
+
+** Counting keys
+ :PROPERTIES:
+ :CUSTOM_ID: howto-basic-verification
+ :END:
+
+ Counting the number of keys in your public keybox (=pubring.kbx=),
+ the format shich has superceded the old keyring format
+ (=pubring.gpg= and =secring.gpg=) is a very simple task.
+
+ #+begin_src python
+ import gpg
+
+ c = gpg.Context()
+ seckeys = c.keylist(pattern=None, secret=True)
+ pubkeys = c.keylist(pattern=None, secret=False)
+
+ seclist = list(seckeys)
+ secnum = len(seclist)
+
+ publist = list(pubkeys)
+ pubnum = len(publist)
+
+ print("""
+ Number of secret keys: {0}
+ Number of public keys: {1}
+ """.format(secnum, pubnum)
+ #+end_src
+
* Copyright and Licensing
:PROPERTIES:
:CUSTOM_ID: copyright-and-license