summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Alejandro <ivanalejandro0@gmail.com>2013-11-21 12:23:33 -0300
committerIvan Alejandro <ivanalejandro0@gmail.com>2013-11-21 12:23:33 -0300
commitdd85ddd5e45b86e60e2d346ead3d09deccbef0ed (patch)
treea9cbe3203988ff2041fbe93bc07f520706fb49c7
parent5be02926efeb775e652c217ade02250b0cc7e3ca (diff)
Remove '+' suffix in email address.
This allows us to support encrypt mails to 'test_user@provider.com' even if was sent to 'test_user+optional_string@provider.com'.
-rw-r--r--keymanager/src/leap/keymanager/openpgp.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/keymanager/src/leap/keymanager/openpgp.py b/keymanager/src/leap/keymanager/openpgp.py
index 0c11d17..cb46371 100644
--- a/keymanager/src/leap/keymanager/openpgp.py
+++ b/keymanager/src/leap/keymanager/openpgp.py
@@ -297,6 +297,11 @@ class OpenPGPScheme(EncryptionScheme):
:rtype: OpenPGPKey
@raise KeyNotFound: If the key was not found on local storage.
"""
+ # Remove the identity suffix after the '+' until the '@'
+ # e.g.: test_user+something@provider.com becomes test_user@probider.com
+ # since the key belongs to the identity without the '+' suffix.
+ address = re.sub(r'\+.*\@', '@', address)
+
doc = self._get_key_doc(address, private)
if doc is None:
raise errors.KeyNotFound(address)