changeset 98d2ca592d6d in /home/hg/repos/gajim
details:http://hg.gajim.org/gajim?cmd=changeset;node=98d2ca592d6d
description: [kepi] ability to use subkeys. Fixes #6051
diffstat:
src/common/gnupg.py | 7 ++++++-
src/common/helpers.py | 13 +++++++++++--
2 files changed, 17 insertions(+), 3 deletions(-)
diffs (54 lines):
diff -r 156f86448525 -r 98d2ca592d6d src/common/gnupg.py
--- a/src/common/gnupg.py Sat Mar 26 22:29:56 2011 +0100
+++ b/src/common/gnupg.py Sat Mar 26 22:35:13 2011 +0100
@@ -488,7 +488,7 @@
result = ListKeys()
self._collect_output(p, result, stdin=p.stdin)
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:
if self.verbose:
print(line)
@@ -830,6 +830,7 @@
if self.curkey['uid']:
self.curkey['uids'].append(self.curkey['uid'])
del self.curkey['uid']
+ self.curkey['subkeys'] = []
self.append(self.curkey)
pub = sec = key
@@ -842,6 +843,10 @@
self.curkey['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):
pass
diff -r 156f86448525 -r 98d2ca592d6d src/common/helpers.py
--- a/src/common/helpers.py Sat Mar 26 22:29:56 2011 +0100
+++ b/src/common/helpers.py Sat Mar 26 22:35:13 2011 +0100
@@ -1261,8 +1261,17 @@
if jid in attached_keys and keyID:
attachedkeyID = attached_keys[attached_keys.index(jid) + 1]
if attachedkeyID != keyID:
- # Mismatch! Another gpg key was expected
- keyID += 'MISMATCH'
+ # Get signing subkeys for the attached key
+ 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:
# An unsigned presence, just use the assigned key
keyID = attached_keys[attached_keys.index(jid) + 1]
_______________________________________________
Commits mailing list
[email protected]
http://lists.gajim.org/cgi-bin/listinfo/commits