Skip to content

Commit

Permalink
fix(mail(web)): display emails extracted from smime certificate
Browse files Browse the repository at this point in the history
Fixes #5440
  • Loading branch information
cgx committed Mar 7, 2022
1 parent 31da2d9 commit 96d00b7
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 2 deletions.
12 changes: 12 additions & 0 deletions SoObjects/Mailer/NSData+SMIME.m
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
#include <openssl/bio.h>
#include <openssl/err.h>
#include <openssl/cms.h>
#include <openssl/x509.h>
#include <openssl/x509v3.h>
#include <openssl/pkcs12.h>
#include <openssl/pem.h>
#endif
Expand Down Expand Up @@ -675,9 +677,18 @@ - (NSDictionary *) certificateDescription
if (x)
{
NSString *subject, *issuer;
NSMutableArray *emails;
int j;
STACK_OF(OPENSSL_STRING) *emlst;
char p[1024];
BIO *buf;

emails = [NSMutableArray array];
emlst = X509_get1_email(x);
for (j = 0; j < sk_OPENSSL_STRING_num(emlst); j++)
[emails addObject: [[NSString stringWithUTF8String: sk_OPENSSL_STRING_value(emlst, j)] lowercaseString]];
X509_email_free(emlst);

memset(p, 0, 1024);
buf = BIO_new(BIO_s_mem());
X509_NAME_print_ex(buf, X509_get_subject_name(x), 0,
Expand All @@ -697,6 +708,7 @@ - (NSDictionary *) certificateDescription
data = [NSDictionary dictionaryWithObjectsAndKeys:
[subject componentsFromMultilineDN], @"subject",
[issuer componentsFromMultilineDN], @"issuer",
emails, @"emails",
nil];
}
else
Expand Down
7 changes: 7 additions & 0 deletions UI/Templates/ContactsUI/UIxContactViewTemplate.wox
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,13 @@
<div class="md-margin" md-whiteframe="3">
<div class="md-padding" layout="row" layout-wrap="layout-wrap">
<div flex="50" flex-xs="100">
<div class="sg-padded--bottom" ng-if="editor.certificate.emails.length">
<div class="md-subhead md-default-theme md-fg md-primary"
ng-bind="::'Email Addresses' | loc"><!-- Email Addresses --></div>
<div class="pseudo-input-field md-body-1"
ng-repeat="email in ::editor.certificate.emails"
ng-bind="email"><!-- email address --></div>
</div>
<div class="md-subhead md-default-theme md-fg md-primary"
ng-bind="::'Subject Name' | loc"><!-- Subject Name --></div>
<div ng-repeat="field in editor.certificate.subject">
Expand Down
4 changes: 2 additions & 2 deletions UI/Templates/MailerUI/UIxMailViewTemplate.wox
Original file line number Diff line number Diff line change
Expand Up @@ -286,9 +286,9 @@
<div class="md-margin" md-whiteframe="3">
<div class="md-padding" layout="row" layout-wrap="layout-wrap">
<div flex="50" flex-xs="100">
<div class="sg-padded--bottom" ng-if="::viewer.message.signed.certificate.emails">
<div class="sg-padded--bottom" ng-if="::viewer.message.signed.certificate.emails.length">
<div class="md-subhead md-default-theme md-fg md-primary"
ng-bind="::'Email Addresses' | loc"><!-- Subject Name --></div>
ng-bind="::'Email Addresses' | loc"><!-- Email Addresses --></div>
<div class="pseudo-input-field md-body-1"
ng-repeat="email in ::viewer.message.signed.certificate.emails"
ng-bind="email"><!-- email address --></div>
Expand Down
7 changes: 7 additions & 0 deletions UI/Templates/PreferencesUI/UIxAccountEditor.wox
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,13 @@
<div class="md-margin" md-whiteframe="3">
<div class="md-padding" layout="row" layout-wrap="layout-wrap">
<div flex="50" flex-xs="100">
<div class="sg-padded--bottom" ng-if="$AccountDialogController.certificate.emails.length">
<div class="md-subhead md-default-theme md-fg md-primary"
ng-bind="::'Email Addresses' | loc"><!-- Email Addresses --></div>
<div class="pseudo-input-field md-body-1"
ng-repeat="email in $AccountDialogController.certificate.emails"
ng-bind="email"><!-- email address --></div>
</div>
<div class="md-subhead md-default-theme md-fg md-primary"
ng-bind="::'Subject Name' | loc"><!-- Subject Name --></div>
<div ng-repeat="field in $AccountDialogController.certificate.subject">
Expand Down

0 comments on commit 96d00b7

Please sign in to comment.