From bf5ce4086647ddf8381b0e75e928c1f675b0cddf Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Thu, 21 Nov 2013 12:23:33 -0300 Subject: 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'. --- src/leap/keymanager/openpgp.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/leap/keymanager') diff --git a/src/leap/keymanager/openpgp.py b/src/leap/keymanager/openpgp.py index 0c11d17b..cb46371c 100644 --- a/src/leap/keymanager/openpgp.py +++ b/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) -- cgit v1.2.3