aboutsummaryrefslogtreecommitdiffstats
path: root/lang/python/examples/howto/advanced/cython/keycount.pyx
blob: f0097db2fbb69fffb8b265d86b9eb78f41afee12 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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))