Commit f6411db9 authored by Philipp Hörist's avatar Philipp Hörist
Browse files

[openpgp] Handle keys not suited for xmpp

parent 52bf024e
......@@ -32,6 +32,13 @@ class KeyringItem:
self._key = key
self._uid = self._get_uid()
@property
def is_xmpp_key(self) -> bool:
try:
return self.jid is not None
except Exception:
return False
def _get_uid(self):
for uid in self._key.uids:
if uid.uid.startswith('xmpp:'):
......@@ -55,7 +62,6 @@ class KeyringItem:
return hash(self.fingerprint)
class GPGME:
def __init__(self, jid, gnuhome):
self._jid = jid
......@@ -109,7 +115,13 @@ class GPGME:
keys = []
with gpg.Context(**self._context_args) as context:
for key in context.keylist():
keys.append(KeyringItem(key))
keyring_item = KeyringItem(key)
if not keyring_item.is_xmpp_key:
log.warning('Key not suited for xmpp: %s', key.fpr)
continue
keys.append(keyring_item)
return keys
def export_key(self, fingerprint):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment