/b-gtk/fix-viz

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz

« back to all changes in this revision

Viewing changes to crypt.py

  • Committer: Daniel Schierbeck
  • Date: 2008-04-01 09:37:45 UTC
  • mto: (450.1.16 trunk)
  • mto: This revision was merged to the branch mainline in revision 458.
  • Revision ID: daniel.schierbeck@gmail.com-20080401093745-jxqol93tgmixye9w
Added support for key trust.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
openpgp = dbus.Interface(bus.get_object(BUS_NAME, OPENPGP_PATH),
19
19
                      OPENPGP_INTERFACE)
20
20
 
 
21
TRUST_NEVER = -1
 
22
TRUST_UNKNOWN = 0
 
23
TRUST_MARGINAL = 1
 
24
TRUST_FULL = 5
 
25
TRUST_ULTIMATE = 10
 
26
 
21
27
def verify(crypttext):
22
28
    return crypto.VerifyText(KEY_TYPE_OPENPGP, 1, crypttext)
23
29
 
24
 
def is_valid(key):
25
 
    (v, field) = openpgp.GetKeyField(key, 'flags')
 
30
def is_valid(signer):
 
31
    (v, field) = openpgp.GetKeyField(signer, 'flags')
26
32
 
27
33
    return v and field & 0x0001
28
34
 
29
 
def get_fingerprint(key):
30
 
    (v, field) = openpgp.GetKeyField(key, 'fingerprint')
 
35
def get_fingerprint(signer):
 
36
    (v, field) = openpgp.GetKeyField(signer, 'fingerprint')
31
37
 
32
38
    if v:
33
39
        return field
34
40
    else:
35
41
        return None
 
42
 
 
43
def get_trust(signer):
 
44
    (v, field) = openpgp.GetKeyField(signer, 'trust')
 
45
 
 
46
    if v is None:
 
47
        return 0
 
48
 
 
49
    return field