aboutsummaryrefslogtreecommitdiff
path: root/src/mailman_pgp
diff options
context:
space:
mode:
authorJ08nY2017-06-19 22:04:58 +0200
committerJ08nY2017-06-19 22:04:58 +0200
commit625d264965f91dfefd301b361524d13b64901c7a (patch)
treee153761ab7b01ba7cb5f99f1ab3cf081ffb050fb /src/mailman_pgp
parent1cc2710aa47159fc7b235f529f889fbcf5afc29f (diff)
downloadmailman-pgp-625d264965f91dfefd301b361524d13b64901c7a.tar.gz
mailman-pgp-625d264965f91dfefd301b361524d13b64901c7a.tar.zst
mailman-pgp-625d264965f91dfefd301b361524d13b64901c7a.zip
Diffstat (limited to 'src/mailman_pgp')
-rw-r--r--src/mailman_pgp/model/list.py8
-rw-r--r--src/mailman_pgp/rest/lists.py7
2 files changed, 11 insertions, 4 deletions
diff --git a/src/mailman_pgp/model/list.py b/src/mailman_pgp/model/list.py
index 764dc1b..521867c 100644
--- a/src/mailman_pgp/model/list.py
+++ b/src/mailman_pgp/model/list.py
@@ -60,7 +60,7 @@ class EncryptedMailingList(Base):
if self._key is None:
# Check the file
if exists(self.key_path) and isfile(self.key_path):
- self._key = PGPKey.from_file(self.key_path)
+ self._key, _ = PGPKey.from_file(self.key_path)
else:
# Check if key generator is running or what? Restart it if not.
# If we race it shutting down and saving the key file
@@ -71,6 +71,12 @@ class EncryptedMailingList(Base):
return self._key
@property
+ def pubkey(self):
+ if self.key is None:
+ return None
+ return self.key.pubkey
+
+ @property
def key_path(self):
return join(config.pgp.keydir_config['list_keydir'],
self.list_id + '.asc')
diff --git a/src/mailman_pgp/rest/lists.py b/src/mailman_pgp/rest/lists.py
index 312661b..7c73364 100644
--- a/src/mailman_pgp/rest/lists.py
+++ b/src/mailman_pgp/rest/lists.py
@@ -12,7 +12,6 @@ class _EncryptedBase(CollectionMixin):
def _resource_as_dict(self, emlist):
"""See `CollectionMixin`."""
return dict(list_id=emlist.list_id,
- key_fingerprint=emlist.key_fingerprint,
unsigned_msg_action=emlist.unsigned_msg_action,
nonencrypted_msg_action=emlist.nonencrypted_msg_action,
strip_original_signature=emlist.strip_original_signature,
@@ -30,7 +29,7 @@ class _EncryptedBase(CollectionMixin):
class AllEncryptedLists(_EncryptedBase):
def on_get(self, request, response):
"""/lists"""
- resource = self._make_collection(response)
+ resource = self._make_collection(request)
return okay(response, etag(resource))
@@ -62,5 +61,7 @@ class AListPubkey:
if self._mlist is None:
return not_found()
else:
- resource = dict(public_key=self._mlist.pubkey)
+ resource = dict(public_key=str(self._mlist.pubkey),
+ key_fingerprint=str(
+ self._mlist.pubkey.fingerprint))
return okay(response, etag(resource))