summaryrefslogtreecommitdiff
path: root/examples/python/keyring.py
blob: 83cf5ff5c390ae3cbb562306d79cd07669ccd64c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/python

# test loading of pywsman
import sys

# cmake build dir
sys.path.insert(0, '../../build/swig/python')

from zypp import ZYppFactory, Pathname, KeyRing, PublicKey


keyring = ZYppFactory.instance().getZYpp().keyRing()

path = Pathname("/suse/aschnell/tmp/repodata/repomd.xml.key")
print path

publickey = PublicKey(path)
print publickey

id = publickey.id()

print "is key known/trusted %s %s" % (keyring.isKeyKnown(id), keyring.isKeyTrusted(id))

keyring.importKey(publickey, True)

print "is key known/trusted %s %s" % (keyring.isKeyKnown(id), keyring.isKeyTrusted(id))

print "list of known keys:"
for key in keyring.publicKeys():
    print key

print "list of trusted keys:"
for key in keyring.trustedPublicKeys():
    print key