mirror of
https://github.com/the-djmaze/snappymail.git
synced 2024-09-20 15:45:55 +08:00
S/MIME don't post identity key and certificate, just fetch from server
This commit is contained in:
parent
4006dd38f8
commit
574fd820a6
|
@ -69,7 +69,7 @@ export const GnuPGUserStore = new class {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (isPrivate) {
|
if (isPrivate) {
|
||||||
key.password = async (btnTxt = 'CRYPTO/SIGN') => {
|
key.password = async btnTxt => {
|
||||||
const pass = await Passphrases.ask(key,
|
const pass = await Passphrases.ask(key,
|
||||||
'GnuPG key<br>' + key.id + ' ' + key.emails[0],
|
'GnuPG key<br>' + key.id + ' ' + key.emails[0],
|
||||||
btnTxt
|
btnTxt
|
||||||
|
@ -228,7 +228,7 @@ export const GnuPGUserStore = new class {
|
||||||
}
|
}
|
||||||
|
|
||||||
async sign(privateKey) {
|
async sign(privateKey) {
|
||||||
return await privateKey.password();
|
return await privateKey.password('CRYPTO/SIGN');
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -1561,12 +1561,13 @@ export class ComposePopupView extends AbstractViewPopup {
|
||||||
}
|
}
|
||||||
if ('S/MIME' == signOptions[i][0]) {
|
if ('S/MIME' == signOptions[i][0]) {
|
||||||
// TODO: sign in PHP fails
|
// TODO: sign in PHP fails
|
||||||
params.signCertificate = identity.smimeCertificate();
|
params.sign = 'S/MIME';
|
||||||
params.signPrivateKey = identity.smimeKey();
|
// params.signCertificate = identity.smimeCertificate();
|
||||||
|
// params.signPrivateKey = identity.smimeKey();
|
||||||
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()}),
|
||||||
'CRYPTO/DECRYPT'
|
'CRYPTO/SIGN'
|
||||||
);
|
);
|
||||||
if (null != pass) {
|
if (null != pass) {
|
||||||
params.signPassphrase = pass.password;
|
params.signPassphrase = pass.password;
|
||||||
|
|
|
@ -930,14 +930,15 @@ trait Messages
|
||||||
$oMessage->DoesNotAddDefaultXMailer();
|
$oMessage->DoesNotAddDefaultXMailer();
|
||||||
}
|
}
|
||||||
|
|
||||||
$sFrom = $this->GetActionParam('from', '');
|
$oMessage->SetFrom(\MailSo\Mime\Email::Parse($this->GetActionParam('from', '')));
|
||||||
$oMessage->SetFrom(\MailSo\Mime\Email::Parse($sFrom));
|
$oFrom = $oMessage->GetFrom();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
$oFromIdentity = $this->GetIdentityByID($oAccount, $this->GetActionParam('identityID', ''));
|
$oIdentity = $this->GetIdentityByID($oAccount, $this->GetActionParam('identityID', ''));
|
||||||
if ($oFromIdentity)
|
if ($oIdentity)
|
||||||
{
|
{
|
||||||
$oMessage->SetFrom(new \MailSo\Mime\Email(
|
$oMessage->SetFrom(new \MailSo\Mime\Email(
|
||||||
$oFromIdentity->Email(), $oFromIdentity->Name()));
|
$oIdentity->Email(), $oIdentity->Name()));
|
||||||
if ($oAccount->Domain()->OutSetSender()) {
|
if ($oAccount->Domain()->OutSetSender()) {
|
||||||
$oMessage->SetSender(\MailSo\Mime\Email::Parse($oAccount->Email()));
|
$oMessage->SetSender(\MailSo\Mime\Email::Parse($oAccount->Email()));
|
||||||
}
|
}
|
||||||
|
@ -947,14 +948,13 @@ trait Messages
|
||||||
$oMessage->SetFrom(\MailSo\Mime\Email::Parse($oAccount->Email()));
|
$oMessage->SetFrom(\MailSo\Mime\Email::Parse($oAccount->Email()));
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
$oFrom = $oMessage->GetFrom();
|
|
||||||
$oMessage->RegenerateMessageId($oFrom ? $oFrom->GetDomain() : '');
|
$oMessage->RegenerateMessageId($oFrom ? $oFrom->GetDomain() : '');
|
||||||
|
|
||||||
$oMessage->SetReplyTo(new \MailSo\Mime\EmailCollection($this->GetActionParam('replyTo', '')));
|
$oMessage->SetReplyTo(new \MailSo\Mime\EmailCollection($this->GetActionParam('replyTo', '')));
|
||||||
|
|
||||||
if (!empty($this->GetActionParam('readReceiptRequest', 0))) {
|
if (!empty($this->GetActionParam('readReceiptRequest', 0))) {
|
||||||
// Read Receipts Reference Main Account Email, Not Identities #147
|
// Read Receipts Reference Main Account Email, Not Identities #147
|
||||||
// $oMessage->SetReadReceipt(($oFromIdentity ?: $oAccount)->Email());
|
// $oMessage->SetReadReceipt(($oIdentity ?: $oAccount)->Email());
|
||||||
$oMessage->SetReadReceipt($oFrom->GetEmail());
|
$oMessage->SetReadReceipt($oFrom->GetEmail());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1169,6 +1169,18 @@ trait Messages
|
||||||
} else {
|
} else {
|
||||||
$sCertificate = $this->GetActionParam('signCertificate', '');
|
$sCertificate = $this->GetActionParam('signCertificate', '');
|
||||||
$sPrivateKey = $this->GetActionParam('signPrivateKey', '');
|
$sPrivateKey = $this->GetActionParam('signPrivateKey', '');
|
||||||
|
if ('S/MIME' === $this->GetActionParam('sign', '')) {
|
||||||
|
$sID = $this->GetActionParam('identityID', '');
|
||||||
|
foreach ($this->GetIdentities($oAccount) as $oIdentity) {
|
||||||
|
if ($oIdentity && $oIdentity->smimeCertificate && $oIdentity->smimeKey
|
||||||
|
&& ($oIdentity->Id() === $sID || $oIdentity->Email() === $oFrom->GetEmail())
|
||||||
|
) {
|
||||||
|
$sCertificate = $oIdentity->smimeCertificate;
|
||||||
|
$sPrivateKey = $oIdentity->smimeKey;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if ($sCertificate && $sPrivateKey) {
|
if ($sCertificate && $sPrivateKey) {
|
||||||
$oBody = $oMessage->GetRootPart();
|
$oBody = $oMessage->GetRootPart();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue