fix(mail(web)): display emails extracted from smime certificate

Fixes #5440
This commit is contained in:
Francis Lachapelle
2022-03-07 11:03:04 -05:00
parent 31da2d9f59
commit 96d00b744e
4 changed files with 28 additions and 2 deletions

View File

@@ -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
@@ -675,9 +677,18 @@ STACK_OF(X509_ALGOR) *CMS_get_smimecap(CMS_SignerInfo *si)
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,
@@ -697,6 +708,7 @@ STACK_OF(X509_ALGOR) *CMS_get_smimecap(CMS_SignerInfo *si)
data = [NSDictionary dictionaryWithObjectsAndKeys:
[subject componentsFromMultilineDN], @"subject",
[issuer componentsFromMultilineDN], @"issuer",
emails, @"emails",
nil];
}
else

View File

@@ -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">

View File

@@ -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>

View File

@@ -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">