Skip to content

Commit

Permalink
Revokation handled correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
Smári McCarthy authored and BjarniRunar committed Jan 19, 2015
1 parent cd91330 commit 3491d45
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
3 changes: 2 additions & 1 deletion mailpile/crypto/gpgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ def parse_pubkey(self, line):
"authenticate": "A" in line["capabilities"],
}
line["disabled"] = "D" in line["capabilities"]
line["revoked"] = "r" in line["validity"]
line["private_key"] = False
line["subkeys"] = []
line["uids"] = []
Expand Down Expand Up @@ -604,7 +605,7 @@ def list_secret_keys(self):
public_keys = self.parse_keylist(retvals[1]["stdout"])
for fprint, info in public_keys.iteritems():
if fprint in secret_keys:
for k in ("disabled", ): # FIXME: Copy more?
for k in ("disabled", "revoked"): # FIXME: Copy more?
secret_keys[fprint][k] = info[k]

return secret_keys
Expand Down
10 changes: 6 additions & 4 deletions mailpile/plugins/crypto_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,8 @@ class GPGCheckKeys(Search):
HTTP_CALLABLE = ('GET', )
COMMAND_CACHE_TTL = 0

MIN_KEYSIZE = 2048

class CommandResult(Command.CommandResult):
def __init__(self, *args, **kwargs):
Command.CommandResult.__init__(self, *args, **kwargs)
Expand Down Expand Up @@ -316,10 +318,10 @@ def command(self):
is_serious = False
elif (not info['capabilities_map'].get('encrypt') or
not info['capabilities_map'].get('sign')):
rev = info.get('revocation_date')
if rev and rev <= today:
k_info['description'] = _('%s: Bad: key was revoked'
if info.get("revoked"):
k_info['description'] = _('%s: --- Revoked.'
) % fprint
is_serious = False
elif exp and exp <= today:
k_info['description'] = _('%s: Bad: expired on %s'
) % (fprint,
Expand All @@ -330,7 +332,7 @@ def command(self):
elif exp and exp <= fortnight:
k_info['description'] = _('%s: Bad: expires on %s'
) % (fprint, info['expiration_date'])
elif k_info['keysize'] < 2048:
elif k_info['keysize'] < self.MIN_KEYSIZE:
k_info['description'] = _('%s: Bad: too small (%d bits)'
) % (fprint, k_info['keysize'])
else:
Expand Down

0 comments on commit 3491d45

Please sign in to comment.