2 edge cases combined resulted in the wrong email being extracted:
- Email address with
+in the name part it. (typical case:
- Certificates with a DN that has fields positioned after the
SNin our case)
So this at the end of the DN failed:
It resulted in this extracted email address:
This fixes both issues.
Note that it adds one assumption: there can never be any comma, slash or space in an email address.