mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-08 08:57:03 +03:00
Changes for #1587
This commit is contained in:
parent
c3c75c216b
commit
97391a3f33
2 changed files with 63 additions and 1 deletions
|
|
@ -1566,6 +1566,10 @@ export class ComposePopupView extends AbstractViewPopup {
|
||||||
params.signed = signed.toString();
|
params.signed = signed.toString();
|
||||||
params.boundary = signed.boundary;
|
params.boundary = signed.boundary;
|
||||||
data = signed;
|
data = signed;
|
||||||
|
/*
|
||||||
|
Object.entries(PgpUserStore.getPublicKeyOfEmails([getEmail(this.from())]) || {})
|
||||||
|
.forEach(([k,v]) => params.publicKey = v);
|
||||||
|
*/
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
sign = false;
|
sign = false;
|
||||||
console.error(e);
|
console.error(e);
|
||||||
|
|
@ -1579,6 +1583,7 @@ export class ComposePopupView extends AbstractViewPopup {
|
||||||
// params.signData = data.toString();
|
// params.signData = data.toString();
|
||||||
params.signFingerprint = signOptions[i][1].fingerprint;
|
params.signFingerprint = signOptions[i][1].fingerprint;
|
||||||
params.signPassphrase = pass;
|
params.signPassphrase = pass;
|
||||||
|
// params.attachPublicKey = false;
|
||||||
} else {
|
} else {
|
||||||
sign = false;
|
sign = false;
|
||||||
}
|
}
|
||||||
|
|
@ -1589,6 +1594,7 @@ export class ComposePopupView extends AbstractViewPopup {
|
||||||
params.sign = 'S/MIME';
|
params.sign = 'S/MIME';
|
||||||
// params.signCertificate = identity.smimeCertificate();
|
// params.signCertificate = identity.smimeCertificate();
|
||||||
// params.signPrivateKey = identity.smimeKey();
|
// params.signPrivateKey = identity.smimeKey();
|
||||||
|
// params.attachCertificate = false;
|
||||||
if (identity.smimeKeyEncrypted()) {
|
if (identity.smimeKeyEncrypted()) {
|
||||||
const pass = await Passphrases.ask(identity,
|
const pass = await Passphrases.ask(identity,
|
||||||
i18n('SMIME/PRIVATE_KEY_OF', {EMAIL: identity.email()}),
|
i18n('SMIME/PRIVATE_KEY_OF', {EMAIL: identity.email()}),
|
||||||
|
|
|
||||||
|
|
@ -1145,7 +1145,25 @@ trait Messages
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
// OpenPGP https://github.com/the-djmaze/snappymail/issues/1587
|
||||||
|
$sPublicKey = $this->GetActionParam('publicKey', '');
|
||||||
|
if ($sPublicKey) {
|
||||||
|
$oMessage->Attachments()->append(
|
||||||
|
new \MailSo\Mime\Attachment(
|
||||||
|
\fopen("data://text/plain,{$sPublicKey}", 'r'),
|
||||||
|
'OpenPGP_'.\md5($sPublicKey).'.asc',
|
||||||
|
\strlen($sPublicKey),
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
array(),
|
||||||
|
'',
|
||||||
|
'application/pgp-keys'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
*/
|
||||||
foreach ($aFoundDataURL as $sCidHash => $sDataUrlString) {
|
foreach ($aFoundDataURL as $sCidHash => $sDataUrlString) {
|
||||||
$aMatch = array();
|
$aMatch = array();
|
||||||
$sCID = '<'.$sCidHash.'>';
|
$sCID = '<'.$sCidHash.'>';
|
||||||
|
|
@ -1171,9 +1189,29 @@ trait Messages
|
||||||
|
|
||||||
$oPassphrase = new \SnappyMail\SensitiveString($this->GetActionParam('signPassphrase', ''));
|
$oPassphrase = new \SnappyMail\SensitiveString($this->GetActionParam('signPassphrase', ''));
|
||||||
|
|
||||||
|
// GnuPG
|
||||||
$sFingerprint = $this->GetActionParam('signFingerprint', '');
|
$sFingerprint = $this->GetActionParam('signFingerprint', '');
|
||||||
if ($sFingerprint) {
|
if ($sFingerprint) {
|
||||||
$GPG = $this->GnuPG();
|
$GPG = $this->GnuPG();
|
||||||
|
/*
|
||||||
|
// https://github.com/the-djmaze/snappymail/issues/1587
|
||||||
|
if ($this->GetActionParam('attachPublicKey', false)) {
|
||||||
|
$sPublicKey = $GPG->export($sFingerprint);
|
||||||
|
$oMessage->Attachments()->append(
|
||||||
|
new \MailSo\Mime\Attachment(
|
||||||
|
\fopen("data://text/plain,{$sPublicKey}", 'r'),
|
||||||
|
"OpenPGP_0x{$sFingerprint}.asc",
|
||||||
|
\strlen($sPublicKey),
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
array(),
|
||||||
|
'',
|
||||||
|
'application/pgp-keys'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
*/
|
||||||
$oBody = $oMessage->GetRootPart();
|
$oBody = $oMessage->GetRootPart();
|
||||||
$resource = $oBody->ToStream();
|
$resource = $oBody->ToStream();
|
||||||
|
|
||||||
|
|
@ -1225,6 +1263,24 @@ trait Messages
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
// https://github.com/the-djmaze/snappymail/issues/1587
|
||||||
|
if ($sCertificate && $this->GetActionParam('attachCertificate', false)) {
|
||||||
|
$oMessage->Attachments()->append(
|
||||||
|
new \MailSo\Mime\Attachment(
|
||||||
|
\fopen("data://text/plain,{$sCertificate}", 'r'),
|
||||||
|
'certificate.pem',
|
||||||
|
\strlen($sCertificate),
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
array(),
|
||||||
|
'',
|
||||||
|
'application/pem-certificate-chain'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
*/
|
||||||
if ($sCertificate && $sPrivateKey) {
|
if ($sCertificate && $sPrivateKey) {
|
||||||
$oBody = $oMessage->GetRootPart();
|
$oBody = $oMessage->GetRootPart();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue