[kepi] ability to use subkeys. Fixes #6051
This commit is contained in:
parent
bba6eb6a27
commit
c79528f646
|
@ -488,7 +488,7 @@ class GPG(object):
|
||||||
result = ListKeys()
|
result = ListKeys()
|
||||||
self._collect_output(p, result, stdin=p.stdin)
|
self._collect_output(p, result, stdin=p.stdin)
|
||||||
lines = result.data.decode(self.encoding).splitlines()
|
lines = result.data.decode(self.encoding).splitlines()
|
||||||
valid_keywords = 'pub uid sec fpr'.split()
|
valid_keywords = 'pub uid sec fpr sub'.split()
|
||||||
for line in lines:
|
for line in lines:
|
||||||
if self.verbose:
|
if self.verbose:
|
||||||
print(line)
|
print(line)
|
||||||
|
@ -830,6 +830,7 @@ class ListKeys(list):
|
||||||
if self.curkey['uid']:
|
if self.curkey['uid']:
|
||||||
self.curkey['uids'].append(self.curkey['uid'])
|
self.curkey['uids'].append(self.curkey['uid'])
|
||||||
del self.curkey['uid']
|
del self.curkey['uid']
|
||||||
|
self.curkey['subkeys'] = []
|
||||||
self.append(self.curkey)
|
self.append(self.curkey)
|
||||||
|
|
||||||
pub = sec = key
|
pub = sec = key
|
||||||
|
@ -842,6 +843,10 @@ class ListKeys(list):
|
||||||
self.curkey['uids'].append(args[9])
|
self.curkey['uids'].append(args[9])
|
||||||
self.uids.append(args[9])
|
self.uids.append(args[9])
|
||||||
|
|
||||||
|
def sub(self, args):
|
||||||
|
subkey = [args[4],args[11]]
|
||||||
|
self.curkey['subkeys'].append(subkey)
|
||||||
|
|
||||||
def handle_status(self, key, value):
|
def handle_status(self, key, value):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
|
@ -1261,8 +1261,17 @@ def prepare_and_validate_gpg_keyID(account, jid, keyID):
|
||||||
if jid in attached_keys and keyID:
|
if jid in attached_keys and keyID:
|
||||||
attachedkeyID = attached_keys[attached_keys.index(jid) + 1]
|
attachedkeyID = attached_keys[attached_keys.index(jid) + 1]
|
||||||
if attachedkeyID != keyID:
|
if attachedkeyID != keyID:
|
||||||
# Mismatch! Another gpg key was expected
|
# Get signing subkeys for the attached key
|
||||||
keyID += 'MISMATCH'
|
subkeys = []
|
||||||
|
for key in gajim.connections[account].gpg.list_keys():
|
||||||
|
if key['keyid'][8:] == attachedkeyID:
|
||||||
|
subkeys = [subkey[0][8:] for subkey in key['subkeys'] \
|
||||||
|
if subkey[1] == 's']
|
||||||
|
break
|
||||||
|
|
||||||
|
if keyID not in subkeys:
|
||||||
|
# Mismatch! Another gpg key was expected
|
||||||
|
keyID += 'MISMATCH'
|
||||||
elif jid in attached_keys:
|
elif jid in attached_keys:
|
||||||
# An unsigned presence, just use the assigned key
|
# An unsigned presence, just use the assigned key
|
||||||
keyID = attached_keys[attached_keys.index(jid) + 1]
|
keyID = attached_keys[attached_keys.index(jid) + 1]
|
||||||
|
|
Loading…
Reference in New Issue